openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #09444
Re: [Merge] lp:~gerald-britton/openlp/newbugs into lp:openlp
On Sun, May 29, 2011 at 6:38 AM, m2j <meinertjordan@xxxxxxxxxx> wrote:
> Hi,
> In my understanding there is a problem in patch line 81:
> log.exception("open_ooo_file failed: %s", url)
> url is Unicode and such it may contain non-ASCII characters. In that case you get a error, as it is not possible to convert it to a 8 bit string automatically.
Really? Did you try it? Can you make it fail? Consider:
>>> import logging
>>> log = logging.getLogger(__name__)
>>> logging.basicConfig()
>>> log.error("hi")
ERROR:__main__:hi
>>> log.exception('test %s',u'foo')
ERROR:__main__:test foo
None
>>> log.exception('test %s',u'операционной')
ERROR:__main__:test операционной
None
These examples work, but the text is unicode:
>>> for i in u'операционной': print ord(i)
...
1086 о
1087 п
1077 е
1088 р
1072 а
1094 ц
1080 и
1086 о
1085 н
1085 н
1086 о
1081 й
>Rather write:
> log.exception(u'open_ooo_file failed: %s', url)
Should not be needed...see example above. Seems that the logger takes
care of it.
> --
> https://code.launchpad.net/~gerald-britton/openlp/newbugs/+merge/62532
> You are the owner of lp:~gerald-britton/openlp/newbugs.
>
--
Gerald Britton
https://code.launchpad.net/~gerald-britton/openlp/newbugs/+merge/62532
Your team OpenLP Core is subscribed to branch lp:openlp.
References