Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Kirill Smelkov
Zope
Commits
21d87fc0
Commit
21d87fc0
authored
May 02, 2006
by
Rocky Burt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
External methods can now live outside of Products based python packages.
parent
309d6f33
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
1 deletion
+25
-1
lib/python/App/FactoryDispatcher.py
lib/python/App/FactoryDispatcher.py
+25
-1
No files found.
lib/python/App/FactoryDispatcher.py
View file @
21d87fc0
...
...
@@ -13,11 +13,35 @@
# Implement the manage_addProduct method of object managers
import
types
import
Acquisition
,
sys
,
Products
from
Globals
import
InitializeClass
from
AccessControl
import
ClassSecurityInfo
from
AccessControl.PermissionMapping
import
aqwrap
from
AccessControl.Owned
import
UnownableOwner
import
Zope2
def
_product_packages
():
"""Returns all product packages including the regularly defined
zope2 packages and those without the Products namespace package.
"""
old_product_packages
=
{}
for
x
in
dir
(
Products
):
m
=
getattr
(
Products
,
x
)
if
isinstance
(
m
,
types
.
ModuleType
):
old_product_packages
[
x
]
=
m
packages
=
{}
products
=
Zope2
.
app
().
Control_Panel
.
Products
for
product_id
in
products
.
objectIds
():
product
=
products
[
product_id
]
if
hasattr
(
product
,
'package_name'
):
packages
[
product_id
]
=
__import__
(
product
.
package_name
)
elif
old_product_packages
.
has_key
(
product_id
):
packages
[
product_id
]
=
old_product_packages
[
product_id
]
return
packages
class
ProductDispatcher
(
Acquisition
.
Implicit
):
" "
...
...
@@ -32,7 +56,7 @@ class ProductDispatcher(Acquisition.Implicit):
# Try to get a custom dispatcher from a Python product
dispatcher_class
=
getattr
(
getattr
(
Products
,
name
,
None
),
_product_packages
().
get
(
name
,
None
),
'__FactoryDispatcher__'
,
FactoryDispatcher
)
...
...
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