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
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
Eteri
erp5
Commits
a5f950b3
Commit
a5f950b3
authored
Dec 10, 2013
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ZODB Components: Cosmetic: Use faster and simpler defaultdict() rather than setdefault().
parent
4b0b4ec4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
product/ERP5Type/dynamic/component_package.py
product/ERP5Type/dynamic/component_package.py
+4
-4
No files found.
product/ERP5Type/dynamic/component_package.py
View file @
a5f950b3
...
@@ -32,6 +32,7 @@ from __future__ import absolute_import
...
@@ -32,6 +32,7 @@ from __future__ import absolute_import
import
sys
import
sys
import
imp
import
imp
import
collections
from
Products.ERP5.ERP5Site
import
getSite
from
Products.ERP5.ERP5Site
import
getSite
from
Products.ERP5Type.Globals
import
get_request
from
Products.ERP5Type.Globals
import
get_request
...
@@ -74,7 +75,7 @@ class ComponentDynamicPackage(ModuleType):
...
@@ -74,7 +75,7 @@ class ComponentDynamicPackage(ModuleType):
self
.
_namespace_prefix
=
namespace
+
'.'
self
.
_namespace_prefix
=
namespace
+
'.'
self
.
_portal_type
=
portal_type
self
.
_portal_type
=
portal_type
self
.
__version_suffix_len
=
len
(
'_version'
)
self
.
__version_suffix_len
=
len
(
'_version'
)
self
.
__registry_dict
=
{}
self
.
__registry_dict
=
collections
.
defaultdict
(
dict
)
# Add this module to sys.path for future imports
# Add this module to sys.path for future imports
sys
.
modules
[
namespace
]
=
self
sys
.
modules
[
namespace
]
=
self
...
@@ -124,9 +125,8 @@ class ComponentDynamicPackage(ModuleType):
...
@@ -124,9 +125,8 @@ class ComponentDynamicPackage(ModuleType):
# beforehand
# beforehand
if
version
in
version_priority_set
:
if
version
in
version_priority_set
:
reference
=
component
.
getReference
(
validated_only
=
True
)
reference
=
component
.
getReference
(
validated_only
=
True
)
self
.
__registry_dict
.
setdefault
(
reference
,
{})[
version
]
=
(
self
.
__registry_dict
[
reference
][
version
]
=
(
component
.
getId
(),
component
.
getId
(),
component
.
_p_oid
)
component
.
_p_oid
)
return
self
.
__registry_dict
return
self
.
__registry_dict
...
...
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