[Erp5-report] r34172 kazuhiko - in /erp5/trunk/products: ERP5/Document/ ERP5/Tool/ ERP5Type...

nobody at svn.erp5.org nobody at svn.erp5.org
Sun Mar 28 22:16:10 CEST 2010


Author: kazuhiko
Date: Sun Mar 28 22:16:10 2010
New Revision: 34172

URL: http://svn.erp5.org?rev=34172&view=rev
Log:
code simplification.

Modified:
    erp5/trunk/products/ERP5/Document/Document.py
    erp5/trunk/products/ERP5/Tool/SimulationTool.py
    erp5/trunk/products/ERP5Type/CachePlugins/RamCache.py
    erp5/trunk/products/ERP5Type/Core/Folder.py
    erp5/trunk/products/ERP5Type/patches/MailTemplates.py

Modified: erp5/trunk/products/ERP5/Document/Document.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/Document.py?rev=34172&r1=34171&r2=34172&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Document.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/Document.py [utf8] Sun Mar 28 22:16:10 2010
@@ -564,7 +564,7 @@
       if method is not None:
         if callable(method):
           val = method()
-          if isinstance(val, list) or isinstance(val, tuple):
+          if isinstance(val, (list, tuple)):
             return list(val)
           return [str(val)]
       val = self.getPropertyList(property)

Modified: erp5/trunk/products/ERP5/Tool/SimulationTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Tool/SimulationTool.py?rev=34172&r1=34171&r2=34172&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Tool/SimulationTool.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Tool/SimulationTool.py [utf8] Sun Mar 28 22:16:10 2010
@@ -1062,7 +1062,7 @@
             if metric_type is None:
               # use the default metric type
               metric_type = quantity_unit.split("/", 1)[0]
-        elif isinstance(quantity_unit, int) or isinstance(quantity_unit, float):
+        elif isinstance(quantity_unit, (int, float)):
           # quantity_unit used to be a numerical parameter..
           raise ValueError('Numeric values for quantity_unit are not supported')
 

Modified: erp5/trunk/products/ERP5Type/CachePlugins/RamCache.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/CachePlugins/RamCache.py?rev=34172&r1=34171&r2=34172&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/CachePlugins/RamCache.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/CachePlugins/RamCache.py [utf8] Sun Mar 28 22:16:10 2010
@@ -44,7 +44,7 @@
   if isinstance(i, dict):
     for k, v in i.items():
       s += calcPythonObjectMemorySize(k) + calcPythonObjectMemorySize(v)
-  elif isinstance(i, list) or isinstance(i, tuple):
+  elif isinstance(i, (list, tuple)):
     for v in i:
       s += calcPythonObjectMemorySize(v)
   return s

Modified: erp5/trunk/products/ERP5Type/Core/Folder.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Core/Folder.py?rev=34172&r1=34171&r2=34172&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Core/Folder.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Core/Folder.py [utf8] Sun Mar 28 22:16:10 2010
@@ -179,7 +179,7 @@
     error_message = 'deleteContent only accepts string or list of strings not '
     if isinstance(id, str):
       self._delObject(id)
-    elif isinstance(id, list) or isinstance(id, tuple):
+    elif isinstance(id, (list, tuple)):
       for my_id in id:
         if isinstance(my_id, str):
           self._delObject(my_id)

Modified: erp5/trunk/products/ERP5Type/patches/MailTemplates.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/patches/MailTemplates.py?rev=34172&r1=34171&r2=34172&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/patches/MailTemplates.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/patches/MailTemplates.py [utf8] Sun Mar 28 22:16:10 2010
@@ -60,7 +60,7 @@
           if value is not None:
               values[key]=value
               # turn some sequences in coma-seperated strings
-              if isinstance(value,tuple) or isinstance(value,list):
+              if isinstance(value, (tuple, list)):
                   value = ', '.join(value)
               # make sure we have no unicode headers
               if isinstance(value,unicode):




More information about the Erp5-report mailing list