[Erp5-report] r42441 nicolas.dumazet - /erp5/trunk/products/ERP5Type/dynamic/lazy_class.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Jan 19 08:24:33 CET 2011


Author: nicolas.dumazet
Date: Wed Jan 19 08:24:33 2011
New Revision: 42441

URL: http://svn.erp5.org?rev=42441&view=rev
Log:
hardcode the meta_type of Types Tool to be able to add it very early, when
bootstrapping an instance.

If we don't dont this, the portal._setObject('portal_types', ...) call while
creating a new site will fail because it will force unghosting the portal
type class of "Types Tool", which is not possible this types tool is not
installed yet.

Modified:
    erp5/trunk/products/ERP5Type/dynamic/lazy_class.py

Modified: erp5/trunk/products/ERP5Type/dynamic/lazy_class.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/dynamic/lazy_class.py?rev=42441&r1=42440&r2=42441&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/dynamic/lazy_class.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/dynamic/lazy_class.py [utf8] Wed Jan 19 08:24:33 2011
@@ -50,6 +50,13 @@ class GhostBaseMetaClass(ExtensionClass)
       Because __bases__ is changed, the behavior of this object
       will change after the first call.
       """
+      # very special case used to bootstrap an instance:
+      # calling _setObject() requires accessing the meta_type of the
+      # object we're setting, but when creating portal_types it's way
+      # too early to load erp5.portal_type.Types Tool
+      if attr == "meta_type" and self.__class__.__name__ == "Types Tool":
+          return "ERP5 Types Tool"
+
       # Class must be loaded if '__of__' is requested because otherwise,
       # next call to __getattribute__ would lose any acquisition wrapper.
       if attr in ('__class__',



More information about the Erp5-report mailing list