[Zope-Checkins] CVS: Zope2 - Application.py:1.149 ObjectManager.py:1.137
andreas@serenade.digicool.com
andreas@serenade.digicool.com
Wed, 30 May 2001 11:58:02 -0400
Update of /cvs-repository/Zope2/lib/python/OFS
In directory serenade:/tmp/cvs-serv21362/lib/python/OFS
Modified Files:
Application.py ObjectManager.py
Log Message:
merged ajung-dropin-registry branch
--- Updated File Application.py in package Zope2 --
--- Application.py 2001/05/23 19:31:36 1.148
+++ Application.py 2001/05/30 15:57:31 1.149
@@ -84,7 +84,6 @@
##############################################################################
__doc__='''Application support
-
$Id$'''
__version__='$Revision$'[11:-2]
@@ -511,6 +510,13 @@
product_names=os.listdir(product_dir)
product_names.sort()
+ # Hack !!!
+ # We must initialize the PluginIndexes first before
+ # all other products (ajung)
+
+ product_names.remove("PluginIndexes")
+ product_names.insert(0,"PluginIndexes")
+
for product_name in product_names:
if done.has_key(product_name): continue
@@ -575,6 +581,14 @@
product_names=os.listdir(product_dir)
product_names.sort()
+
+ # Hack !!!
+ # We must initialize the PluginIndexes first before
+ # all other products (ajung)
+
+ product_names.remove("PluginIndexes")
+ product_names.insert(0,"PluginIndexes")
+
for product_name in product_names:
# For each product, we will import it and try to call the
--- Updated File ObjectManager.py in package Zope2 --
--- ObjectManager.py 2001/04/27 18:07:12 1.136
+++ ObjectManager.py 2001/05/30 15:57:31 1.137
@@ -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,32 @@
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 = []
+
+ 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__+
@@ -689,5 +710,17 @@
lst.append( (dirname + obj.id + "/" + name,child) )
return lst
+
+class IFAwareObjectManager:
+ def all_meta_types(self, interfaces=None):
+
+ 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
+
+ return ObjectManager.all_meta_types(self, interfaces)
Globals.default__class_init__(ObjectManager)