[Erp5-report] r18230 - /erp5/trunk/products/ERP5Type/Accessor/Translation.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Dec 11 14:18:41 CET 2007


Author: yusei
Date: Tue Dec 11 14:18:41 2007
New Revision: 18230

URL: http://svn.erp5.org?rev=18230&view=rev
Log:
Prevent KeyError if type information does not exist in type tool.

Modified:
    erp5/trunk/products/ERP5Type/Accessor/Translation.py

Modified: erp5/trunk/products/ERP5Type/Accessor/Translation.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Accessor/Translation.py?rev=18230&r1=18229&r2=18230&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Accessor/Translation.py (original)
+++ erp5/trunk/products/ERP5Type/Accessor/Translation.py Tue Dec 11 14:18:41 2007
@@ -101,12 +101,16 @@
       ptype_domain = None
       ptype = instance.getPortalType()
       ptypes_tool = instance.getPortalObject()['portal_types']
-      domain_dict = ptypes_tool[ptype].getPropertyTranslationDomainDict()
-      domain = domain_dict.get(self._original_key)
-      if domain is None:
+      typeinfo = ptypes_tool.getTypeInfo(ptype)
+      if typeinfo is None:
         ptype_domain = ''
       else:
-        ptype_domain = domain.getDomainName()
+        domain_dict = typeinfo.getPropertyTranslationDomainDict()
+        domain = domain_dict.get(self._original_key)
+        if domain is None:
+          ptype_domain = ''
+        else:
+          ptype_domain = domain.getDomainName()
       if ptype_domain is '' and default is not None:
         # then get the default property defined on property sheet
         value = default




More information about the Erp5-report mailing list