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
138
Merge Requests
138
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
9e318064
Commit
9e318064
authored
Dec 16, 2019
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP: ZODB Components: Set Mixin reference from the class name (like Interfaces).
TODO: Refactor with Interfaces code.
parent
fc7e3878
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
product/ERP5/Document/BusinessTemplate.py
product/ERP5/Document/BusinessTemplate.py
+26
-0
No files found.
product/ERP5/Document/BusinessTemplate.py
View file @
9e318064
...
...
@@ -6633,6 +6633,32 @@ Business Template is a set of definitions, such as skins, portal types and categ
continue
subsubmodule_name
=
interface_class_name
elif
component_portal_type
==
'Mixin Component'
:
try
:
mixin_module
=
__import__
(
source_reference
,
{},
{},
source_reference
)
except
ImportError
,
e
:
LOG
(
"BusinessTemplate"
,
WARNING
,
"Skipping %s: Cannot be imported (%s)"
%
(
filepath
,
e
))
continue
mixin_class_name
=
None
for
_
,
m
in
inspect
.
getmembers
(
mixin_module
,
inspect
.
isclass
):
if
(
m
.
__name__
.
endswith
(
'Mixin'
)
and
# Local definition only
m
.
__module__
==
mixin_module
.
__name__
):
if
mixin_class_name
is
not
None
:
# Do not try to be clever, just let the developer fix the problem
LOG
(
"BusinessTemplate"
,
WARNING
,
"Skipping %s: More than one Mixin defined"
%
filepath
)
mixin_class_name
=
None
break
else
:
mixin_class_name
=
m
.
__name__
if
mixin_class_name
is
None
:
continue
subsubmodule_name
=
mixin_class_name
obj
=
__newTempComponent
(
portal_type
=
subsubmodule_portal_type
,
reference
=
subsubmodule_name
,
...
...
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