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
amrani
erp5
Commits
6432cda0
Commit
6432cda0
authored
Feb 01, 2012
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
When loading Component, look for matching reference in portal_components rather than ID.
parent
4a112c8e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
13 deletions
+20
-13
product/ERP5Type/dynamic/component_class.py
product/ERP5Type/dynamic/component_class.py
+16
-11
product/ERP5Type/dynamic/dynamic_module.py
product/ERP5Type/dynamic/dynamic_module.py
+4
-2
No files found.
product/ERP5Type/dynamic/component_class.py
View file @
6432cda0
...
...
@@ -57,26 +57,31 @@ class ComponentModule(ModuleType):
from
types
import
ModuleType
from
zLOG
import
LOG
,
INFO
def
generateComponentClassWrapper
(
namespace
):
def
generateComponentClassWrapper
(
namespace
,
portal_type
):
def
generateComponentClass
(
component_name
):
site
=
getSite
()
# XXX-arnau: erp5.component.extension.VERSION.REFERENCE perhaps but there
# should be a a way to specify priorities such as portal_skins maybe?
component_id
=
'%s.%s'
%
(
namespace
,
component_name
)
try
:
component
=
getattr
(
site
.
portal_components
,
component_id
)
except
AttributeError
:
# XXX-arnau: Performances?
component
=
site
.
portal_catalog
.
unrestrictedSearchResults
(
parent_uid
=
site
.
portal_components
.
getUid
(),
reference
=
component_name
,
validation_state
=
(
'validated'
,
'modified'
),
portal_type
=
portal_type
)[
0
].
getObject
()
except
IndexError
:
LOG
(
"ERP5Type.dynamic"
,
INFO
,
"Could not find %s, perhaps it has not been migrated yet?"
%
\
component_id
)
raise
raise
AttributeError
(
"Component %s not found or not validated"
%
\
component_id
)
else
:
if
component
.
getValidationState
()
==
'validated'
:
new_module
=
ModuleType
(
component_id
,
component
.
getDescription
())
component
.
load
(
new_module
.
__dict__
,
validated_only
=
True
)
LOG
(
"ERP5Type.dynamic"
,
INFO
,
"Loaded successfully %s"
%
component_id
)
return
new_module
else
:
raise
AttributeError
(
"Component %s not validated"
%
component_id
)
return
generateComponentClass
product/ERP5Type/dynamic/dynamic_module.py
View file @
6432cda0
...
...
@@ -129,8 +129,10 @@ def initializeDynamicModules():
erp5
.
component
.
extension
=
registerDynamicModule
(
'erp5.component.extension'
,
generateComponentClassWrapper
(
'erp5.component.extension'
))
generateComponentClassWrapper
(
'erp5.component.extension'
,
'Extension Component'
))
erp5
.
component
.
document
=
registerDynamicModule
(
'erp5.component.document'
,
generateComponentClassWrapper
(
'erp5.component.document'
))
generateComponentClassWrapper
(
'erp5.component.document'
,
'Document Component'
))
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