[Zope-Checkins] CVS: Zope2 - ObjectManager.py:1.136.6.1
andreas@digicool.com
andreas@digicool.com
Wed, 9 May 2001 09:42:52 -0400 (EDT)
Update of /cvs-repository/Zope2/lib/python/OFS
In directory korak:/tmp/cvs-serv9656
Modified Files:
Tag: ajung-dropin-registry
ObjectManager.py
Log Message:
--- Updated File ObjectManager.py in package Zope2 --
--- ObjectManager.py 2001/04/27 18:07:12 1.136
+++ ObjectManager.py 2001/05/09 13:42:51 1.136.6.1
@@ -159,6 +159,7 @@
class BeforeDeleteException( Exception ): pass # raise to veto deletion
+class BreakoutException ( Exception ): pass # raised to break out of loops
_marker=[]
class ObjectManager(
@@ -197,6 +198,7 @@
_objects =()
manage_main=DTMLFile('dtml/main', globals())
+ manage_index_main=DTMLFile('dtml/index_main', globals())
manage_options=(
{'label':'Contents', 'action':'manage_main',
@@ -222,13 +224,39 @@
default__class_init__(self)
- def all_meta_types(self):
+ def all_meta_types(self, interfaces=None):
pmt=()
if hasattr(self, '_product_meta_types'): pmt=self._product_meta_types
elif hasattr(self, 'aq_acquire'):
try: pmt=self.aq_acquire('_product_meta_types')
except: pass
- return self.meta_types+Products.meta_types+pmt
+
+ gmt = []
+
+ if interfaces is None:
+ if hasattr(self, '_product_interfaces'):
+ interfaces=self._product_interfaces
+ elif hasattr(self, 'aq_acquire'):
+ try: interfaces=self.aq_acquire('_product_interfaces')
+ except: pass # Bleah generic pass is bad
+
+ for entry in Products.meta_types:
+ if interfaces is None:
+ if entry.get("visibility", None) == "Global":
+ gmt.append(entry)
+ else:
+ try:
+ eil = entry.get("interfaces", None)
+ if eil is not None:
+ for ei in eil:
+ for i in interfaces:
+ if ei is i or ei.extends(i):
+ gmt.append(entry)
+ raise BreakoutException # only append 1ce
+ except BreakoutException:
+ pass
+
+ return list(self.meta_types)+gmt+list(pmt)
def _subobject_permissions(self):
return (Products.__ac_permissions__+