[Erp5-report] r40150 arnaud.fontaine - in /erp5/trunk/products/ERP5Type: Core/ Tool/

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Nov 10 04:27:47 CET 2010


Author: arnaud.fontaine
Date: Wed Nov 10 04:27:47 2010
New Revision: 40150

URL: http://svn.erp5.org?rev=40150&view=rev
Log:
Fix typos and the elementary_type getter to return None rather than
raising an exception if the type of a ZODB Property Sheets property
has not been set yet


Modified:
    erp5/trunk/products/ERP5Type/Core/StandardProperty.py
    erp5/trunk/products/ERP5Type/Tool/PropertySheetTool.py

Modified: erp5/trunk/products/ERP5Type/Core/StandardProperty.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Core/StandardProperty.py?rev=40150&r1=40149&r2=40150&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Core/StandardProperty.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Core/StandardProperty.py [utf8] Wed Nov 10 04:27:47 2010
@@ -79,7 +79,7 @@ class StandardProperty(XMLObject):
       if category.startswith('elementary_type/'):
         return category.split('elementary_type/')[1]
 
-    raise AttributeError("%s: Could not get elementary_type" % self)
+    return None
 
   getStorageId = BaseGetter('getStorageId', 'storage_id', 'string')
 
@@ -131,7 +131,7 @@ class StandardProperty(XMLObject):
             'translatable': self.getTranslatable(),
             'translation_domain': self.getTranslationDomain()}
 
-  def _convertFromFilesytemPropertyDict(self, filesystem_property_dict):
+  def _convertFromFilesystemPropertyDict(self, filesystem_property_dict):
     """
     Convert a property dict coming from a Property Sheet on the
     filesystem to a ZODB property dict
@@ -162,4 +162,5 @@ class StandardProperty(XMLObject):
     """
     Set attributes from the filesystem definition of a property
     """
-    self.edit(**self._convertFromFilesytemPropertyDict(filesystem_property_dict))
+    self.edit(**self._convertFromFilesystemPropertyDict(
+      filesystem_property_dict))

Modified: erp5/trunk/products/ERP5Type/Tool/PropertySheetTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Tool/PropertySheetTool.py?rev=40150&r1=40149&r2=40150&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Tool/PropertySheetTool.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Tool/PropertySheetTool.py [utf8] Wed Nov 10 04:27:47 2010
@@ -63,7 +63,7 @@ class PropertySheetTool(BaseTool):
             )
 
   @staticmethod
-  def _guessFilesytemPropertyPortalType(attribute_dict):
+  def _guessFilesystemPropertyPortalType(attribute_dict):
     """
     Guess the Portal Type of a filesystem-based Property Sheet from
     the attributes of the given property
@@ -91,7 +91,7 @@ class PropertySheetTool(BaseTool):
     for attribute_dict in getattr(klass, '_properties', []):
       # The property could be either a Standard or an Acquired
       # Property
-      portal_type = self._guessFilesytemPropertyPortalType(attribute_dict)
+      portal_type = self._guessFilesystemPropertyPortalType(attribute_dict)
 
       # Create the new property and set its attributes
       new_property = new_property_sheet.newContent(portal_type=portal_type)
@@ -103,9 +103,7 @@ class PropertySheetTool(BaseTool):
       portal_type = isinstance(category, Expression) and \
         'Dynamic Category Property' or 'Category Property'
 
-      new_category = new_property_sheet.newContent(
-        portal_type=portal_type)
-
+      new_category = new_property_sheet.newContent(portal_type=portal_type)
       new_category.importFromFilesystemDefinition(category)
 
     return new_property_sheet




More information about the Erp5-report mailing list