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
4910caba
Commit
4910caba
authored
Mar 30, 1999
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Can now deregister all of the meta types for a product.
parent
03748277
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
13 deletions
+37
-13
lib/python/App/ProductRegistry.py
lib/python/App/ProductRegistry.py
+37
-13
No files found.
lib/python/App/ProductRegistry.py
View file @
4910caba
...
...
@@ -95,27 +95,33 @@
from
OFS.Folder
import
Folder
class
ProductRegistry
:
class
ProductRegistry
Mixin
:
# This class implements a protocol for registering products that
# are defined through the web. It also provides methods for
# getting hold of the Product Registry, Control_Panel.Products.
# are defined through the web.
# This class is a mix-in class for the top-level application object.
def
_getProducts
(
self
):
return
self
.
Control_Panel
.
Products
_product_meta_types
=
()
def
_manage_remove_product_meta_type
(
self
,
product
,
id
,
meta_type
):
self
.
_product_meta_types
=
filter
(
lambda
mt
,
nmt
=
meta_type
:
mt
[
'name'
]
!=
nmt
,
self
.
_product_meta_types
)
def
_manage_remove_product_meta_type
(
self
,
product
,
id
=
None
,
meta_type
=
None
):
r
=
[]
pid
=
product
.
id
for
mt
in
self
.
_getProductRegistryMetaTypes
():
if
mt
.
has_key
(
'product'
):
if
mt
[
'product'
]
==
pid
and
(
meta_type
is
None
or
meta_type
==
mt
[
'name'
]):
continue
elif
meta_type
==
mt
[
'name'
]:
continue
r
.
append
(
mt
)
self
.
_setProductRegistryMetaTypes
(
tuple
(
r
))
def
_manage_add_product_meta_type
(
self
,
product
,
id
,
meta_type
,
permission
=
''
):
pid
=
product
.
id
for
mt
in
self
.
_product_meta_types
:
meta_types
=
self
.
_getProductRegistryMetaTypes
()
for
mt
in
meta_types
:
if
mt
[
'name'
]
==
meta_type
:
if
not
mt
.
has_key
(
'product'
):
mt
[
'product'
]
=
pid
if
mt
[
'product'
]
!=
pid
:
...
...
@@ -132,4 +138,22 @@ class ProductRegistry:
}
if
permission
:
mt
[
'permission'
]
=
permission
self
.
_product_meta_types
=
self
.
_product_meta_types
+
(
mt
,)
self
.
_setProductRegistryMetaTypes
(
meta_types
+
(
mt
,))
class
ProductRegistry
(
ProductRegistryMixin
):
# This class implements a protocol for registering products that
# are defined through the web. It also provides methods for
# getting hold of the Product Registry, Control_Panel.Products.
# This class is a mix-in class for the top-level application object.
def
_getProducts
(
self
):
return
self
.
Control_Panel
.
Products
_product_meta_types
=
()
def
_getProductRegistryMetaTypes
(
self
):
return
self
.
_product_meta_types
def
_setProductRegistryMetaTypes
(
self
,
v
):
self
.
_product_meta_types
=
v
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