Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alecs_myu
erp5
Commits
c6d2392e
Commit
c6d2392e
authored
Jun 12, 2013
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use OOBTree instead of PersistentMapping for PasswordTool's dict.
to avoid conflicts and to improve disk space efficiency.
parent
6b83d2b1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
9 deletions
+6
-9
product/ERP5/Tool/PasswordTool.py
product/ERP5/Tool/PasswordTool.py
+6
-9
No files found.
product/ERP5/Tool/PasswordTool.py
View file @
c6d2392e
...
@@ -40,6 +40,7 @@ from hashlib import md5
...
@@ -40,6 +40,7 @@ from hashlib import md5
from
DateTime
import
DateTime
from
DateTime
import
DateTime
from
Products.ERP5Type.Message
import
translateString
from
Products.ERP5Type.Message
import
translateString
from
Products.ERP5Type.Globals
import
PersistentMapping
from
Products.ERP5Type.Globals
import
PersistentMapping
from
BTrees.OOBTree
import
OOBTree
from
urllib
import
urlencode
from
urllib
import
urlencode
class
PasswordTool
(
BaseTool
):
class
PasswordTool
(
BaseTool
):
...
@@ -60,12 +61,11 @@ class PasswordTool(BaseTool):
...
@@ -60,12 +61,11 @@ class PasswordTool(BaseTool):
_expiration_day
=
1
_expiration_day
=
1
_password_request_dict
=
{}
def
__init__
(
self
,
id
=
None
):
def
__init__
(
self
,
id
=
None
):
if
id
is
None
:
if
id
is
None
:
id
=
self
.
__class__
.
id
id
=
self
.
__class__
.
id
self
.
_password_request_dict
=
PersistentMapping
()
self
.
_password_request_dict
=
OOBTree
()
# XXX no call to BaseTool.__init__ ?
# XXX no call to BaseTool.__init__ ?
# BaseTool.__init__(self, id)
# BaseTool.__init__(self, id)
...
@@ -77,13 +77,10 @@ class PasswordTool(BaseTool):
...
@@ -77,13 +77,10 @@ class PasswordTool(BaseTool):
# generate a random string
# generate a random string
key
=
self
.
_generateUUID
()
key
=
self
.
_generateUUID
()
# XXX before r26093, _password_request_dict was initialized by an OOBTree and
if
isinstance
(
self
.
_password_request_dict
,
PersistentMapping
):
# replaced by a dict on each request, so if it's data structure is not up
LOG
(
'ERP5.PasswordTool'
,
INFO
,
'Migrating password_request_dict to'
# to date, we update it if needed
' OOBTree'
)
if
not
isinstance
(
self
.
_password_request_dict
,
PersistentMapping
):
self
.
_password_request_dict
=
OOBTree
(
self
.
_password_request_dict
)
LOG
(
'ERP5.PasswordTool'
,
INFO
,
'Updating password_request_dict to'
' PersistentMapping'
)
self
.
_password_request_dict
=
PersistentMapping
()
# register request
# register request
self
.
_password_request_dict
[
key
]
=
(
user_login
,
expiration_date
)
self
.
_password_request_dict
[
key
]
=
(
user_login
,
expiration_date
)
...
...
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