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
144
Merge Requests
144
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
f039766f
Commit
f039766f
authored
Jun 08, 2020
by
Nicolas Wavrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "mixin/composition: remove the cache at the class level"
This reverts commit
dca8e49f
.
parent
dca8e49f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
product/ERP5/mixin/composition.py
product/ERP5/mixin/composition.py
+10
-2
No files found.
product/ERP5/mixin/composition.py
View file @
f039766f
...
...
@@ -119,11 +119,19 @@ class asComposedDocument(object):
This class should be seen as a function, and it is named accordingly.
It is out of CompositionMixin class to avoid excessive indentation.
"""
# Cache created classes to make other caches (like Base.aq_portal_type)
# useful and avoid memory leaks.
__class_cache
=
{}
def
__new__
(
cls
,
orig_self
,
portal_type_list
=
None
):
self
=
orig_self
.
asContext
(
_portal_type_list
=
portal_type_list
)
# XXX-JPS orig_self -> original_self - please follow conventions
from
erp5.component.document.BusinessProcess
import
BusinessProcess
self
.
__class__
=
type
(
self
.
__class__
.
__name__
,
(
cls
,
self
.
__class__
,
BusinessProcess
),
{})
base_class
=
self
.
__class__
try
:
self
.
__class__
=
cls
.
__class_cache
[
base_class
]
except
KeyError
:
from
erp5.component.document.BusinessProcess
import
BusinessProcess
cls
.
__class_cache
[
base_class
]
=
self
.
__class__
=
\
type
(
base_class
.
__name__
,
(
cls
,
base_class
,
BusinessProcess
),
{})
# here we could inherit many "useful" classes dynamically - héhé
# that would be a "real" abstract composition system
self
.
_effective_model_list
,
specialise_value_list
=
\
...
...
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