Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5_rtl_support
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
Romain Courteaud
erp5_rtl_support
Commits
b9839738
Commit
b9839738
authored
Jan 18, 2012
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure that erp5.component modules are reset on all ZEO clients.
parent
13908ec0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
6 deletions
+39
-6
product/ERP5Type/Tool/ComponentTool.py
product/ERP5Type/Tool/ComponentTool.py
+8
-3
product/ERP5Type/dynamic/component_class.py
product/ERP5Type/dynamic/component_class.py
+28
-1
product/ERP5Type/dynamic/dynamic_module.py
product/ERP5Type/dynamic/dynamic_module.py
+3
-2
No files found.
product/ERP5Type/Tool/ComponentTool.py
View file @
b9839738
...
@@ -46,14 +46,19 @@ class ComponentTool(BaseTool):
...
@@ -46,14 +46,19 @@ class ComponentTool(BaseTool):
security
=
ClassSecurityInfo
()
security
=
ClassSecurityInfo
()
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
def
reset
(
self
):
def
reset
(
self
,
is_sync
=
False
):
"""
"""
XXX-arnau: global reset
XXX-arnau: global reset
"""
"""
import
erp5.component
import
erp5.component
container_type_info
=
self
.
getPortalObject
().
portal_types
.
getTypeInfo
(
portal
=
self
.
getPortalObject
()
self
.
getPortalType
())
if
not
is_sync
:
portal
.
newCacheCookie
(
'component_classes'
)
erp5
.
component
.
_last_reset
=
portal
.
getCacheCookie
(
'component_classes'
)
container_type_info
=
portal
.
portal_types
.
getTypeInfo
(
self
.
getPortalType
())
for
content_type
in
container_type_info
.
getTypeAllowedContentTypeList
():
for
content_type
in
container_type_info
.
getTypeAllowedContentTypeList
():
module_name
=
content_type
.
split
(
' '
)[
0
].
lower
()
module_name
=
content_type
.
split
(
' '
)[
0
].
lower
()
...
...
product/ERP5Type/dynamic/component_class.py
View file @
b9839738
...
@@ -26,12 +26,39 @@
...
@@ -26,12 +26,39 @@
#
#
##############################################################################
##############################################################################
from
Products.ERP5.ERP5Site
import
getSite
from
types
import
ModuleType
class
ComponentModule
(
ModuleType
):
_resetting
=
False
_last_reset
=
-
1
def
__getattribute__
(
self
,
name
):
"""
Synchronize between ZEO clients
XXX-arnau: surely bad from a performance POV and not thread-safe
"""
if
name
[
0
]
==
'_'
or
self
.
_resetting
:
return
super
(
ComponentModule
,
self
).
__getattribute__
(
name
)
import
erp5.component
site
=
getSite
()
cookie
=
site
.
getCacheCookie
(
'component_classes'
)
if
self
.
_last_reset
==
-
1
:
self
.
_last_reset
=
site
.
getCacheCookie
(
'component_classes'
)
elif
cookie
!=
self
.
_last_reset
:
self
.
_resetting
=
True
site
.
portal_components
.
reset
(
is_sync
=
True
)
self
.
_resetting
=
False
return
super
(
ComponentModule
,
self
).
__getattribute__
(
name
)
from
types
import
ModuleType
from
types
import
ModuleType
from
zLOG
import
LOG
,
INFO
from
zLOG
import
LOG
,
INFO
def
generateComponentClassWrapper
(
namespace
):
def
generateComponentClassWrapper
(
namespace
):
def
generateComponentClass
(
component_name
):
def
generateComponentClass
(
component_name
):
from
Products.ERP5.ERP5Site
import
getSite
site
=
getSite
()
site
=
getSite
()
component_id
=
'%s.%s'
%
(
namespace
,
component_name
)
component_id
=
'%s.%s'
%
(
namespace
,
component_name
)
...
...
product/ERP5Type/dynamic/dynamic_module.py
View file @
b9839738
...
@@ -122,10 +122,11 @@ def initializeDynamicModules():
...
@@ -122,10 +122,11 @@ def initializeDynamicModules():
loadTempPortalTypeClass
)
loadTempPortalTypeClass
)
# Components
# Components
erp5
.
component
=
ModuleType
(
"erp5.component"
)
from
component_class
import
ComponentModule
,
generateComponentClassWrapper
erp5
.
component
=
ComponentModule
(
"erp5.component"
)
sys
.
modules
[
"erp5.component"
]
=
erp5
.
component
sys
.
modules
[
"erp5.component"
]
=
erp5
.
component
from
component_class
import
generateComponentClassWrapper
erp5
.
component
.
extension
=
registerDynamicModule
(
erp5
.
component
.
extension
=
registerDynamicModule
(
'erp5.component.extension'
,
'erp5.component.extension'
,
generateComponentClassWrapper
(
'erp5.component.extension'
))
generateComponentClassWrapper
(
'erp5.component.extension'
))
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