[Erp5-report] r19830 - /erp5/trunk/products/ERP5Type/Base.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Mar 12 14:33:08 CET 2008


Author: alex
Date: Wed Mar 12 14:33:06 2008
New Revision: 19830

URL: http://svn.erp5.org?rev=19830&view=rev
Log:
* _getDefaultAcquiredProperty: compare value to null_value instead of None.
  null_value is a tuple of all values that should be considered as null for
  this type, and is defined in ERP5Type/Accessor/TypeDefinition.py

* getCompactTitle, getCompactTranslatedTitle: use hasProperty('reference')
  instead of hasReference, as the latter only exists on classes that use the
  reference property.

Modified:
    erp5/trunk/products/ERP5Type/Base.py

Modified: erp5/trunk/products/ERP5Type/Base.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Base.py?rev=19830&r1=19829&r2=19830&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Base.py (original)
+++ erp5/trunk/products/ERP5Type/Base.py Wed Mar 12 14:33:06 2008
@@ -1079,7 +1079,7 @@
       else:
         value = None
       # If we hold an attribute and mask_value is set, return the attribute
-      if mask_value and value is not None:
+      if mask_value and value not in null_value:
         # Pop context
         if is_tales_type:
           expression = Expression(value)
@@ -1113,7 +1113,7 @@
             setattr(self, storage_id, value)
         if is_list_type:
           # We must provide the first element of the acquired list
-          if value is None:
+          if value in null_value:
             result = None
           else:
             if isinstance(value, (list, tuple)):
@@ -1128,7 +1128,7 @@
           result = value
       else:
         result = None
-      if result is not None:
+      if result not in null_value:
         return result
       else:
         #LOG("alt_accessor_id",0,str(alt_accessor_id))
@@ -1138,7 +1138,7 @@
             method = getattr(self, id, None)
             if callable(method):
               result = method()
-              if result is not None:
+              if result not in null_value:
                 if is_list_type:
                   if isinstance(result, (list, tuple)):
                     # We must provide the first element of the alternate result
@@ -2402,7 +2402,7 @@
     if self.hasShortTitle():
       r = self.getShortTitle()
       if r: return r
-    if self.hasReference():
+    if self.getProperty('reference'):
       r = self.getReference()
       if r: return r
     r = self._baseGetTitle() # No need to test existence since all Base instances have this method
@@ -2436,7 +2436,7 @@
       if r: return r
       r = self.getShortTitle()
       if r: return r
-    if self.hasReference():
+    if self.getProperty('reference'):
       r = self.getReference()
       if r: return r
     r = self._baseGetTranslatedTitle() # No need to test existence since all Base instances have this method




More information about the Erp5-report mailing list