From b7f4423ced6c43d452d84c2398f17de5a1a1bc80 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Fri, 16 Mar 2012 16:55:54 +0100 Subject: [PATCH] [FIX] Fix broken creation of database in previous commit - d'oh bzr revid: odo@openerp.com-20120316155554-uq32b9ken6rcm02p --- openerp/loglevels.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/openerp/loglevels.py b/openerp/loglevels.py index 8973453aabd..374efea8d84 100644 --- a/openerp/loglevels.py +++ b/openerp/loglevels.py @@ -131,10 +131,10 @@ def ustr(value, hint_encoding='utf-8', errors='strict'): upstream and should be tried first to decode ``value``. :param str error: optional `errors` flag to pass to the unicode built-in to indicate how illegal character values should be - treated: 'strict', 'ignore' or 'replace'. Passing anything - other than 'strict' means that the first encoding tried will - succeed, even if it's not the correct one to use, so be - careful! + treated when converting a string: 'strict', 'ignore' or 'replace'. + Passing anything other than 'strict' means that the first + encoding tried will be used, even if it's not the correct + one to use, so be careful! Ignore if value is not a string/unicode. :rtype: unicode :raise: UnicodeError if value cannot be coerced to unicode """ @@ -146,7 +146,7 @@ def ustr(value, hint_encoding='utf-8', errors='strict'): if not isinstance(value, basestring): try: - return unicode(value, errors=errors) + return unicode(value) except Exception: raise UnicodeError('unable to convert %r' % (value,)) @@ -158,13 +158,13 @@ def ustr(value, hint_encoding='utf-8', errors='strict'): raise UnicodeError('unable to convert %r' % (value,)) -def exception_to_unicode(e, errors='strict'): +def exception_to_unicode(e): if (sys.version_info[:2] < (2,6)) and hasattr(e, 'message'): return ustr(e.message) if hasattr(e, 'args'): - return "\n".join((ustr(a, errors=errors) for a in e.args)) + return "\n".join((ustr(a) for a in e.args)) try: - return unicode(e, errors=errors) + return unicode(e) except Exception: return u"Unknown message"