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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Romain Courteaud
erp5
Commits
77a158d3
Commit
77a158d3
authored
Feb 26, 2012
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only add to the registry Components with version in version_priority of ERP5 site.
parent
5d0a22f7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
7 deletions
+14
-7
product/ERP5Type/dynamic/component_class.py
product/ERP5Type/dynamic/component_class.py
+14
-7
No files found.
product/ERP5Type/dynamic/component_class.py
View file @
77a158d3
...
@@ -94,24 +94,31 @@ class ComponentDynamicPackage(ModuleType):
...
@@ -94,24 +94,31 @@ class ComponentDynamicPackage(ModuleType):
be a a way to specify priorities such as portal_skins maybe?
be a a way to specify priorities such as portal_skins maybe?
"""
"""
if
not
self
.
__registry_dict
:
if
not
self
.
__registry_dict
:
portal
=
getSite
()
try
:
try
:
component_tool
=
getSite
()
.
portal_components
component_tool
=
portal
.
portal_components
# XXX-arnau: When installing ERP5 site, erp5_core_components has not
# XXX-arnau: When installing ERP5 site, erp5_core_components has not
# been installed yet, thus this will obviously failed...
# been installed yet, thus this will obviously failed...
except
AttributeError
:
except
AttributeError
:
return
{}
return
{}
# XXX-arnau: contentValues should not be used as there may be a large
version_priority_set
=
set
(
portal
.
getVersionPriority
())
# number of objects, but as this is done only once, that should perhaps
# not be a problem after all, and using the Catalog is too risky as it
# contentValues should not be used for a large number of objects, but
# lags behind and depends upon objects being reindexed
# this is only done at startup or upon reset, moreover using the Catalog
# is too risky as it lags behind and depends upon objects being
# reindexed
for
component
in
component_tool
.
contentValues
(
portal_type
=
self
.
_portal_type
):
for
component
in
component_tool
.
contentValues
(
portal_type
=
self
.
_portal_type
):
# Only consider modified or validated states as state transition will
# Only consider modified or validated states as state transition will
# be handled by component_validation_workflow which will take care of
# be handled by component_validation_workflow which will take care of
# updating the registry
# updating the registry
if
component
.
getValidationState
()
in
(
'modified'
,
'validated'
):
if
component
.
getValidationState
()
in
(
'modified'
,
'validated'
):
reference
=
component
.
getReference
(
validated_only
=
True
)
version
=
component
.
getVersion
(
validated_only
=
True
)
version
=
component
.
getVersion
(
validated_only
=
True
)
# The versions should have always been set on ERP5Site property
# beforehand
if
version
in
version_priority_set
:
reference
=
component
.
getReference
(
validated_only
=
True
)
self
.
__registry_dict
.
setdefault
(
reference
,
{})[
version
]
=
component
self
.
__registry_dict
.
setdefault
(
reference
,
{})[
version
]
=
component
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