[Erp5-report] r8614 - /erp5/trunk/products/ERP5Type/Utils.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Jul 19 20:42:19 CEST 2006


Author: yo
Date: Wed Jul 19 20:42:18 2006
New Revision: 8614

URL: http://svn.erp5.org?rev=8614&view=rev
Log:
Make it an error if the parameter is not a string or a unicode in convertToUpperCase and convertToMixedCase.

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

Modified: erp5/trunk/products/ERP5Type/Utils.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Utils.py?rev=8614&r1=8613&r2=8614&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Utils.py (original)
+++ erp5/trunk/products/ERP5Type/Utils.py Wed Jul 19 20:42:18 2006
@@ -134,9 +134,8 @@
     This function turns an attribute name into
     a method name according to the ERP5 naming conventions
   """
-  if not isinstance(key, str):
-    LOG('ERP5Type.Utils.convertToUpperCase', PROBLEM,
-        'key `%s` is type %s' % (key, type(key)))
+  if not isinstance(key, basestring):
+    raise TypeError, '%s is not a string' % (key,)
   return ''.join([part.capitalize() for part in str(key).split('_')])
 
 UpperCase = convertToUpperCase
@@ -146,9 +145,8 @@
     This function turns an attribute name into
     a method name according to the ERP5 naming conventions
   """
-  if not isinstance(key, str):
-    LOG('ERP5Type.Utils.convertToMixedCase', PROBLEM,
-        'key `%s` is type %s' % (key, type(key)))
+  if not isinstance(key, basestring):
+    raise TypeError, '%s is not a string' % (key,)
   parts = str(key).split('_', 1)
   if len(parts) == 2:
     parts[1] = convertToUpperCase(parts[1])




More information about the Erp5-report mailing list