Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
ac8f6f41
Commit
ac8f6f41
authored
Mar 29, 2002
by
Chris McDonough
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merging from 2.5 branch.
parent
625b85d0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
14 deletions
+24
-14
lib/python/Products/Sessions/SessionDataManager.py
lib/python/Products/Sessions/SessionDataManager.py
+23
-13
lib/python/Products/Sessions/dtml/addDataManager.dtml
lib/python/Products/Sessions/dtml/addDataManager.dtml
+1
-1
No files found.
lib/python/Products/Sessions/SessionDataManager.py
View file @
ac8f6f41
...
...
@@ -11,7 +11,7 @@
#
############################################################################
import
re
,
time
,
sys
import
re
,
time
,
s
tring
,
s
ys
import
Globals
from
OFS.SimpleItem
import
Item
from
Acquisition
import
Implicit
,
Explicit
,
aq_base
...
...
@@ -23,6 +23,7 @@ from zLOG import LOG, WARNING, BLATHER
from
AccessControl
import
ClassSecurityInfo
import
SessionInterfaces
from
SessionPermissions
import
*
from
types
import
StringType
from
common
import
DEBUG
from
ZPublisher.BeforeTraverse
import
registerBeforeTraverse
,
\
unregisterBeforeTraverse
...
...
@@ -150,7 +151,7 @@ class SessionDataManager(Item, Implicit, Persistent, RoleManager, Owned, Tabs):
'
Container
path
contains
characters
invalid
in
a
Zope
'
'
object
path
'
)
self.obpath =
path.split(
'
/
')
self.obpath =
string.split(path,
'
/
')
elif type(path) in (type([]), type(())):
self.obpath = list(path) # sequence
else:
...
...
@@ -160,7 +161,7 @@ class SessionDataManager(Item, Implicit, Persistent, RoleManager, Owned, Tabs):
def getContainerPath(self):
""" """
if self.obpath is not None:
return
'
/
'.join(self.obpath
)
return
string.join(self.obpath, '
/
'
)
return '' # blank string represents undefined state
def _hasSessionDataObject(self, key):
...
...
@@ -194,7 +195,7 @@ class SessionDataManager(Item, Implicit, Persistent, RoleManager, Owned, Tabs):
# be construed as a security hole, albeit a minor one.
# unrestrictedTraverse is also much faster.
if DEBUG and not hasattr(self, '
_v_wrote_dc_type
'):
args =
'
/
'.join(self.obpath
)
args =
string.join(self.obpath, '
/
'
)
LOG('
Session
Tracking
', BLATHER,
'
External
data
container
at
%
s
in
use
' % args)
self._v_wrote_dc_type = 1
...
...
@@ -202,7 +203,7 @@ class SessionDataManager(Item, Implicit, Persistent, RoleManager, Owned, Tabs):
except:
raise SessionDataManagerErr, (
"External session data container '
%
s
' not found." %
'
/
'.join(self.obpath
)
string.join(self.obpath,'
/
'
)
)
security.declareProtected(MGMT_SCREEN_PERM, '
getRequestName
')
...
...
@@ -229,24 +230,33 @@ class SessionDataManager(Item, Implicit, Persistent, RoleManager, Owned, Tabs):
self._requestSessionName = None
if requestSessionName:
hook = SessionDataManagerTraverser(requestSessionName, self)
hook = SessionDataManagerTraverser(requestSessionName, self
.id
)
registerBeforeTraverse(parent, hook, '
SessionDataManager
', 50)
self._hasTraversalHook = 1
self._requestSessionName = requestSessionName
class SessionDataManagerTraverser(Persistent):
def __init__(self, requestSessionName, s
dm
):
def __init__(self, requestSessionName, s
essionDataManagerName
):
self._requestSessionName = requestSessionName
self._sessionDataManager = s
dm
self._sessionDataManager = s
essionDataManagerName
def __call__(self, container, request):
def __call__(self, container, request
, StringType=StringType
):
try:
sdm = self._sessionDataManager.__of__(container)
session = sdm.getSessionData
sdmName = self._sessionDataManager
if not isinstance(sdmName, StringType):
# Zopes v2.5.0 - 2.5.1b1 stuck the actual session data
# manager object in _sessionDataManager in order to use
# its getSessionData method. We don'
t
actually
want
to
# do this, because it's safer to use getattr to get the
# data manager object by name. Using getattr also puts
# the sdm in the right context automatically. Here we
# pay the penance for backwards compatibility:
sdmName
=
sdmName
.
id
sdm
=
getattr
(
container
,
sdmName
)
getSessionData
=
sdm
.
getSessionData
except
:
msg
=
'Session automatic traversal failed to get session data'
LOG
(
'Session Tracking'
,
WARNING
,
msg
,
error
=
sys
.
exc_info
())
return
if
self
.
_requestSessionName
is
not
None
:
request.set_lazy(self._requestSessionName, session)
request
.
set_lazy
(
self
.
_requestSessionName
,
getSessionData
)
lib/python/Products/Sessions/dtml/addDataManager.dtml
View file @
ac8f6f41
...
...
@@ -43,7 +43,7 @@ user.
<div class="form-label">
Transient Object Container Path
</div>
<div class="form-help">e.g. '/temp_folder/
transient_container
'.</div>
<div class="form-help">e.g. '/temp_folder/
session_data
'.</div>
</TD>
<TD ALIGN="LEFT" VALIGN="TOP">
<INPUT TYPE="TEXT" NAME="path" SIZE="60" value="">
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment