Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Arnaud Fontaine
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
Hide 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,15 +131,27 @@ def initializeDynamicModules():
...
@@ -136,15 +131,27 @@ 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
erp5
.
component
.
extension
=
ComponentDynamicPackage
(
'erp5.component.extension'
,
# Prevent other threads to create erp5.* packages and modules or seeing them
'Extension Component'
)
# incompletely
imp
.
acquire_lock
()
erp5
.
component
.
document
=
ComponentDynamicPackage
(
'erp5.component.document'
,
try
:
'Document Component'
)
sys
.
modules
[
"erp5"
]
=
erp5
sys
.
modules
[
"erp5.document"
]
=
erp5
.
document
erp5
.
component
.
test
=
ComponentDynamicPackage
(
'erp5.component.test'
,
sys
.
modules
[
"erp5.accessor_holder"
]
=
erp5
.
accessor_holder
'Test Component'
)
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'
,
'Extension Component'
)
erp5
.
component
.
document
=
ComponentDynamicPackage
(
'erp5.component.document'
,
'Document Component'
)
erp5
.
component
.
test
=
ComponentDynamicPackage
(
'erp5.component.test'
,
'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