Commit 9a123d3b authored by Yoshinori Okuji's avatar Yoshinori Okuji

Make it an error if the parameter is not a string or a unicode in...

Make it an error if the parameter is not a string or a unicode in convertToUpperCase and convertToMixedCase.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@8614 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 51004709
......@@ -134,9 +134,8 @@ def convertToUpperCase(key):
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 @@ def convertToMixedCase(key):
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])
......
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