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
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
Łukasz Nowak
erp5
Commits
7c28916e
Commit
7c28916e
authored
Aug 15, 2013
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent other threads to create erp5.* packages and modules or seeing them incompletely loaded.
parent
e695947f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
15 deletions
+22
-15
product/ERP5Type/dynamic/dynamic_module.py
product/ERP5Type/dynamic/dynamic_module.py
+22
-15
No files found.
product/ERP5Type/dynamic/dynamic_module.py
View file @
7c28916e
...
@@ -30,6 +30,7 @@
...
@@ -30,6 +30,7 @@
from
types
import
ModuleType
from
types
import
ModuleType
from
.
import
aq_method_lock
from
.
import
aq_method_lock
import
sys
import
sys
import
imp
class
PackageType
(
ModuleType
):
class
PackageType
(
ModuleType
):
"""
"""
...
@@ -103,25 +104,19 @@ def initializeDynamicModules():
...
@@ -103,25 +104,19 @@ def initializeDynamicModules():
holds Live Test modules previously found in bt5 in $INSTANCE_HOME/test
holds Live Test modules previously found in bt5 in $INSTANCE_HOME/test
"""
"""
erp5
=
PackageType
(
"erp5"
)
erp5
=
PackageType
(
"erp5"
)
sys
.
modules
[
"erp5"
]
=
erp5
# Document classes without physical import path
# Document classes without physical import path
erp5
.
document
=
ModuleType
(
"erp5.document"
)
erp5
.
document
=
ModuleType
(
"erp5.document"
)
sys
.
modules
[
"erp5.document"
]
=
erp5
.
document
# Portal types as classes
# Portal types as classes
from
accessor_holder
import
AccessorHolderType
,
AccessorHolderModuleType
from
accessor_holder
import
AccessorHolderType
,
AccessorHolderModuleType
erp5
.
accessor_holder
=
AccessorHolderModuleType
(
"erp5.accessor_holder"
)
erp5
.
accessor_holder
=
AccessorHolderModuleType
(
"erp5.accessor_holder"
)
erp5
.
accessor_holder
.
__path__
=
[]
erp5
.
accessor_holder
.
__path__
=
[]
sys
.
modules
[
"erp5.accessor_holder"
]
=
erp5
.
accessor_holder
erp5
.
accessor_holder
.
property_sheet
=
\
erp5
.
accessor_holder
.
property_sheet
=
\
AccessorHolderModuleType
(
"erp5.accessor_holder.property_sheet"
)
AccessorHolderModuleType
(
"erp5.accessor_holder.property_sheet"
)
sys
.
modules
[
"erp5.accessor_holder.property_sheet"
]
=
\
erp5
.
accessor_holder
.
property_sheet
erp5
.
accessor_holder
.
portal_type
=
registerDynamicModule
(
erp5
.
accessor_holder
.
portal_type
=
registerDynamicModule
(
'erp5.accessor_holder.portal_type'
,
'erp5.accessor_holder.portal_type'
,
AccessorHolderModuleType
)
AccessorHolderModuleType
)
...
@@ -136,10 +131,20 @@ def initializeDynamicModules():
...
@@ -136,10 +131,20 @@ def initializeDynamicModules():
# ZODB Components
# ZODB Components
erp5
.
component
=
PackageType
(
"erp5.component"
)
erp5
.
component
=
PackageType
(
"erp5.component"
)
sys
.
modules
[
"erp5.component"
]
=
erp5
.
component
from
component_package
import
ComponentDynamicPackage
from
component_package
import
ComponentDynamicPackage
# Prevent other threads to create erp5.* packages and modules or seeing them
# incompletely
imp
.
acquire_lock
()
try
:
sys
.
modules
[
"erp5"
]
=
erp5
sys
.
modules
[
"erp5.document"
]
=
erp5
.
document
sys
.
modules
[
"erp5.accessor_holder"
]
=
erp5
.
accessor_holder
sys
.
modules
[
"erp5.accessor_holder.property_sheet"
]
=
\
erp5
.
accessor_holder
.
property_sheet
sys
.
modules
[
"erp5.component"
]
=
erp5
.
component
erp5
.
component
.
extension
=
ComponentDynamicPackage
(
'erp5.component.extension'
,
erp5
.
component
.
extension
=
ComponentDynamicPackage
(
'erp5.component.extension'
,
'Extension Component'
)
'Extension Component'
)
...
@@ -148,3 +153,5 @@ def initializeDynamicModules():
...
@@ -148,3 +153,5 @@ def initializeDynamicModules():
erp5
.
component
.
test
=
ComponentDynamicPackage
(
'erp5.component.test'
,
erp5
.
component
.
test
=
ComponentDynamicPackage
(
'erp5.component.test'
,
'Test Component'
)
'Test Component'
)
finally
:
imp
.
release_lock
()
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