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
692942ed
Commit
692942ed
authored
Nov 08, 2001
by
matt@zope.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure new will return new Transient if the old one is invalid
parent
9a08121d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
6 deletions
+14
-6
lib/python/Products/Transience/Transience.py
lib/python/Products/Transience/Transience.py
+14
-6
No files found.
lib/python/Products/Transience/Transience.py
View file @
692942ed
...
@@ -85,10 +85,10 @@
...
@@ -85,10 +85,10 @@
"""
"""
Core session tracking SessionData class.
Core session tracking SessionData class.
$Id: Transience.py,v 1.1
2 2001/11/07 22:09:5
3 matt Exp $
$Id: Transience.py,v 1.1
3 2001/11/08 21:02:4
3 matt Exp $
"""
"""
__version__
=
'$Revision: 1.1
2
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.1
3
$'
[
11
:
-
2
]
import
Globals
import
Globals
from
Globals
import
HTMLFile
,
MessageDialog
from
Globals
import
HTMLFile
,
MessageDialog
...
@@ -223,7 +223,9 @@ class TransientObjectContainer(SimpleItem):
...
@@ -223,7 +223,9 @@ class TransientObjectContainer(SimpleItem):
if
type
(
key
)
is
not
type
(
''
):
if
type
(
key
)
is
not
type
(
''
):
raise
TypeError
,
(
key
,
"key is not a string type"
)
raise
TypeError
,
(
key
,
"key is not a string type"
)
if
self
.
has_key
(
key
):
if
self
.
has_key
(
key
):
raise
KeyError
,
key
# Not allowed to dup keys
if
self
[
key
].
isValid
():
raise
KeyError
,
key
# Not allowed to dup keys
del
self
[
key
]
item
=
TransientObject
(
key
)
item
=
TransientObject
(
key
)
self
[
key
]
=
item
self
[
key
]
=
item
...
@@ -460,7 +462,7 @@ class TransientObjectContainer(SimpleItem):
...
@@ -460,7 +462,7 @@ class TransientObjectContainer(SimpleItem):
index
[
k
]
=
current
index
[
k
]
=
current
# change the value
# change the value
current
[
k
]
=
v
current
[
k
]
=
v
v
.
setLastAccessed
(
)
self
.
_setLastAccessed
(
v
)
def
__getitem__
(
self
,
k
):
def
__getitem__
(
self
,
k
):
current
=
self
.
_getCurrentBucket
()
current
=
self
.
_getCurrentBucket
()
...
@@ -473,11 +475,17 @@ class TransientObjectContainer(SimpleItem):
...
@@ -473,11 +475,17 @@ class TransientObjectContainer(SimpleItem):
# we accessed the object, so it should become current.
# we accessed the object, so it should become current.
index
[
k
]
=
current
# change the index to the current bucket.
index
[
k
]
=
current
# change the index to the current bucket.
current
[
k
]
=
v
# add the value to the current bucket.
current
[
k
]
=
v
# add the value to the current bucket.
v
.
setLastAccessed
(
)
self
.
_setLastAccessed
(
v
)
del
b
[
k
]
# delete the item from the old bucket.
del
b
[
k
]
# delete the item from the old bucket.
return
v
return
v
security
.
declareProtected
(
ACCESS_TRANSIENTS_PERM
,
'get'
)
def
_setLastAccessed
(
self
,
transientObject
):
# A safety valve; dont try to set the last accessed time if the
# object we were given doesnt support it
sla
=
getattr
(
transientObject
,
'setLastAccessed'
,
None
)
if
sla
is
not
None
:
sla
()
security
.
declareProtected
(
ACCESS_TRANSIENTS_PERM
,
'set'
)
def
set
(
self
,
k
,
v
):
def
set
(
self
,
k
,
v
):
""" """
""" """
if
type
(
k
)
is
not
type
(
''
):
if
type
(
k
)
is
not
type
(
''
):
...
...
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