Commit db31ca26 authored by Arnaud Fontaine's avatar Arnaud Fontaine

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



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@40150 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2c3c583f
...@@ -79,7 +79,7 @@ class StandardProperty(XMLObject): ...@@ -79,7 +79,7 @@ class StandardProperty(XMLObject):
if category.startswith('elementary_type/'): if category.startswith('elementary_type/'):
return category.split('elementary_type/')[1] return category.split('elementary_type/')[1]
raise AttributeError("%s: Could not get elementary_type" % self) return None
getStorageId = BaseGetter('getStorageId', 'storage_id', 'string') getStorageId = BaseGetter('getStorageId', 'storage_id', 'string')
...@@ -131,7 +131,7 @@ class StandardProperty(XMLObject): ...@@ -131,7 +131,7 @@ class StandardProperty(XMLObject):
'translatable': self.getTranslatable(), 'translatable': self.getTranslatable(),
'translation_domain': self.getTranslationDomain()} '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 Convert a property dict coming from a Property Sheet on the
filesystem to a ZODB property dict filesystem to a ZODB property dict
...@@ -162,4 +162,5 @@ class StandardProperty(XMLObject): ...@@ -162,4 +162,5 @@ class StandardProperty(XMLObject):
""" """
Set attributes from the filesystem definition of a property Set attributes from the filesystem definition of a property
""" """
self.edit(**self._convertFromFilesytemPropertyDict(filesystem_property_dict)) self.edit(**self._convertFromFilesystemPropertyDict(
filesystem_property_dict))
...@@ -63,7 +63,7 @@ class PropertySheetTool(BaseTool): ...@@ -63,7 +63,7 @@ class PropertySheetTool(BaseTool):
) )
@staticmethod @staticmethod
def _guessFilesytemPropertyPortalType(attribute_dict): def _guessFilesystemPropertyPortalType(attribute_dict):
""" """
Guess the Portal Type of a filesystem-based Property Sheet from Guess the Portal Type of a filesystem-based Property Sheet from
the attributes of the given property the attributes of the given property
...@@ -91,7 +91,7 @@ class PropertySheetTool(BaseTool): ...@@ -91,7 +91,7 @@ class PropertySheetTool(BaseTool):
for attribute_dict in getattr(klass, '_properties', []): for attribute_dict in getattr(klass, '_properties', []):
# The property could be either a Standard or an Acquired # The property could be either a Standard or an Acquired
# Property # Property
portal_type = self._guessFilesytemPropertyPortalType(attribute_dict) portal_type = self._guessFilesystemPropertyPortalType(attribute_dict)
# Create the new property and set its attributes # Create the new property and set its attributes
new_property = new_property_sheet.newContent(portal_type=portal_type) new_property = new_property_sheet.newContent(portal_type=portal_type)
...@@ -103,9 +103,7 @@ class PropertySheetTool(BaseTool): ...@@ -103,9 +103,7 @@ class PropertySheetTool(BaseTool):
portal_type = isinstance(category, Expression) and \ portal_type = isinstance(category, Expression) and \
'Dynamic Category Property' or 'Category Property' 'Dynamic Category Property' or 'Category Property'
new_category = new_property_sheet.newContent( new_category = new_property_sheet.newContent(portal_type=portal_type)
portal_type=portal_type)
new_category.importFromFilesystemDefinition(category) new_category.importFromFilesystemDefinition(category)
return new_property_sheet return new_property_sheet
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment