[Erp5-report] r30824 - /erp5/trunk/products/ERP5Type/Tool/TypesTool.py

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Nov 23 18:18:39 CET 2009


Author: leonardo
Date: Mon Nov 23 18:18:38 2009
New Revision: 30824

URL: http://svn.erp5.org?rev=30824&view=rev
Log:
make local copy of method that was removed on CMF 2. We will remove it as well eventually

Modified:
    erp5/trunk/products/ERP5Type/Tool/TypesTool.py

Modified: erp5/trunk/products/ERP5Type/Tool/TypesTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Tool/TypesTool.py?rev=30824&r1=30823&r2=30824&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Tool/TypesTool.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Tool/TypesTool.py [utf8] Mon Nov 23 18:18:38 2009
@@ -59,10 +59,47 @@
         return None
     return self._getOb(portal_type, None)
 
+  security.declareProtected(Permissions.AddPortalContent, 'listDefaultTypeInformation')
+  def listDefaultTypeInformation(self):
+      # FIXME: This method is only used by manage_addTypeInformation below, and
+      # should be removed when that method starts raising NotImplementedError.
+      #
+      # Scans for factory_type_information attributes
+      # of all products and factory dispatchers within products.
+      import Products
+      res = []
+      products = self.aq_acquire('_getProducts')()
+      for product in products.objectValues():
+          product_id = product.getId()
+
+          if hasattr(aq_base(product), 'factory_type_information'):
+              ftis = product.factory_type_information
+          else:
+              package = getattr(Products, product_id, None)
+              dispatcher = getattr(package, '__FactoryDispatcher__', None)
+              ftis = getattr(dispatcher, 'factory_type_information', None)
+
+          if ftis is not None:
+              if callable(ftis):
+                  ftis = ftis()
+
+              for fti in ftis:
+                  mt = fti.get('meta_type', None)
+                  id = fti.get('id', '')
+
+                  if mt:
+                      p_id = '%s: %s (%s)' % (product_id, id, mt)
+                      res.append( (p_id, fti) )
+
+      return res
+
+
   security.declareProtected(Permissions.AddPortalContent,
                             'manage_addTypeInformation')
   def manage_addTypeInformation(self, add_meta_type, id=None,
                                 typeinfo_name=None, RESPONSE=None):
+    # FIXME: This method is deprecated and should be reimplemented as a blocker
+    # i.e. a method that always raises a NotImplementedError
     """
     Create a TypeInformation in self.
 




More information about the Erp5-report mailing list