[Erp5-report] r42877 nicolas.dumazet - in /erp5/trunk/products: ERP5/ ERP5Type/dynamic/

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Feb 1 08:56:17 CET 2011


Author: nicolas.dumazet
Date: Tue Feb  1 08:56:16 2011
New Revision: 42877

URL: http://svn.erp5.org?rev=42877&view=rev
Log:
refine logging to avoid being pedantic when installing Sites.

I need some way to distinguish what happens when, later, an automatic migration
happens, or when a Tool is not found: if this happens in a "normal" context,
then logging should be very loud and verbose, as this is likely to crash your
site.
On the other hand, during bootstrap/setup, this is perfectly normal to miss
some tools/modules, and we should not worry/log about it, or the NECESSARY
logs will be quickly removed by developers tired of seeing "useless" logs...

Better ideas that can work in a fresh site without workflows, portal types,
or any advanced mechanism? I'm all ears.

Modified:
    erp5/trunk/products/ERP5/ERP5Site.py
    erp5/trunk/products/ERP5Type/dynamic/portal_type_class.py

Modified: erp5/trunk/products/ERP5/ERP5Site.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/ERP5Site.py?rev=42877&r1=42876&r2=42877&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/ERP5Site.py [utf8] (original)
+++ erp5/trunk/products/ERP5/ERP5Site.py [utf8] Tue Feb  1 08:56:16 2011
@@ -1561,6 +1561,13 @@ class ERP5Generator(PortalGenerator):
     # Make sure reindex will not be called until business templates
     # will be installed
     setattr(portal, 'isIndexable', ConstantGetter('isIndexable', value=False))
+
+    # This is only used to refine log level.
+    # Has no functional use, and should never have any:
+    # if you use it for something else than a logging-oriented hint,
+    # trolls *will* chase you and haunt you in your dreams
+    portal._v_bootstrapping = True
+
     parent._setObject(id, portal)
     # Return the fully wrapped object.
     p = parent.this()._getOb(id)
@@ -1583,6 +1590,9 @@ class ERP5Generator(PortalGenerator):
     p._setProperty('management_page_charset', 'UTF-8', 'string')
     self.setup(p, create_userfolder, create_activities=create_activities,
         reindex=reindex, **kw)
+
+    p._v_bootstrapping = False
+
     return p
 
   def setupLastTools(self, p, create_activities=True, **kw):

Modified: erp5/trunk/products/ERP5Type/dynamic/portal_type_class.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/dynamic/portal_type_class.py?rev=42877&r1=42876&r2=42877&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/dynamic/portal_type_class.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/dynamic/portal_type_class.py [utf8] Tue Feb  1 08:56:16 2011
@@ -239,9 +239,10 @@ def generatePortalTypeClass(site, portal
     # The Property Sheet Tool may be None if the code is updated but
     # the BT has not been upgraded yet with portal_property_sheets
     if property_sheet_tool is None:
-      LOG("ERP5Type.dynamic", WARNING,
-          "Property Sheet Tool was not found. Please update erp5_core "
-          "Business Template")
+      if not getattr(site, '_v_bootstrapping', False):
+        LOG("ERP5Type.dynamic", WARNING,
+            "Property Sheet Tool was not found. Please update erp5_core "
+            "Business Template")
     else:
       if portal_type is not None:
         # Get the Property Sheets defined on the portal_type and use the



More information about the Erp5-report mailing list