Commit 6335f676 authored by Jérome Perrin's avatar Jérome Perrin

Add a warning when calling convertToUpperCase with a key which is not a string

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6840 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9a4529b4
......@@ -133,6 +133,9 @@ 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)))
return ''.join([part.capitalize() for part in str(key).split('_')])
UpperCase = convertToUpperCase
......@@ -142,6 +145,9 @@ 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)))
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