From 9a123d3bd5bd55ec5c3e836c0e751db4f06b8683 Mon Sep 17 00:00:00 2001
From: Yoshinori Okuji <yo@nexedi.com>
Date: Wed, 19 Jul 2006 18:42:18 +0000
Subject: [PATCH] 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
---
 product/ERP5Type/Utils.py | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/product/ERP5Type/Utils.py b/product/ERP5Type/Utils.py
index da0bc9bcb4..e76e66687b 100644
--- a/product/ERP5Type/Utils.py
+++ b/product/ERP5Type/Utils.py
@@ -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])
-- 
2.30.9