[Erp5-report] r38641 nicolas.dumazet - in /erp5/trunk/products/ERP5Type: ./ Tool/

nobody at svn.erp5.org nobody at svn.erp5.org
Sun Sep 26 01:07:04 CEST 2010


Author: nicolas.dumazet
Date: Sun Sep 26 01:07:03 2010
New Revision: 38641

URL: http://svn.erp5.org?rev=38641&view=rev
Log:
declare a registry for mixins and documents as ERP5Type.Document will soon
disappear, and qs we'll need to access classes from anywhere in the code

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

Modified: erp5/trunk/products/ERP5Type/Tool/TypesTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Tool/TypesTool.py?rev=38641&r1=38640&r2=38641&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Tool/TypesTool.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Tool/TypesTool.py [utf8] Sun Sep 26 01:07:03 2010
@@ -161,6 +161,22 @@ class TypesTool(TypeProvider):
         return None
     return getattr(self, portal_type, None)
 
+  security.declareProtected(Permissions.AccessContentsInformation, 'getDocumentTypeList')
+  def getDocumentTypeList(self):
+    """
+    Return a list of Document types that can be used as Base classes
+    """
+    from Products.ERP5Type import document_class_registry
+    return sorted(document_class_registry)
+
+  security.declareProtected(Permissions.AccessContentsInformation, 'getMixinTypeList')
+  def getMixinTypeList(self):
+    """
+    Return a list of classes names that can be used as Mixins
+    """
+    from Products.ERP5Type import mixin_class_registry
+    return sorted(mixin_class_registry)
+
   security.declareProtected(Permissions.AddPortalContent, 'listDefaultTypeInformation')
   def listDefaultTypeInformation(self):
       # FIXME: This method is only used by manage_addTypeInformation below, and

Modified: erp5/trunk/products/ERP5Type/__init__.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/__init__.py?rev=38641&r1=38640&r2=38641&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/__init__.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/__init__.py [utf8] Sun Sep 26 01:07:03 2010
@@ -33,6 +33,13 @@
 from zLOG import LOG, INFO
 DISPLAY_BOOT_PROCESS = False
 
+# This is used to register all Document classes used in ERP5
+# items are class names, values are class paths, e.g.:
+#   'Person' -> 'Products.ERP5.Document.Person.Person'
+document_class_registry = {}
+# similarly for mixins
+mixin_class_registry = {}
+
 # Switch(es) for ongoing development which require single code base
 
 # Update ERP5 Globals




More information about the Erp5-report mailing list