[ckan-dev] FYI: avoiding one unicode issue

David Raznick david.raznick at okfn.org
Tue Aug 21 09:29:13 UTC 2012


Hello

Added to that if you are using
'hello, {name}'.format(name='wođðßæd')
this may not work.

You need to be adding the u,  i.e
u'hello, {name}'.format(name='wođðßæd')

There have been some errors caused by this.

Thanks

David

On Tue, Aug 21, 2012 at 10:20 AM, Toby Dacre <toby.okfn at gmail.com> wrote:
> I've just greped the code and we have several places in the code stuff like
>
> log.debug('Updated object %s' % str(pkg.name))
>
> These break if unicode is used.  as %s converts to string format str() is
> unneeded
>
> log.debug('Updated object %s' % pkg.name)  works without throwing an
> exception if unicode is present
>
> This was an issue for Océane the other day I fixed that one place but it
> seems we have it elsewhere
>
> grep -rI \%s..*str\(| wc -l  gives 78 instances - on the 2375 branch is
> fixing these something we could give to someone new to the project as a
> piece of work? or is that being mean?
>
> also should we try to do all our strings a u'...'
>
> Toby
>
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> http://lists.okfn.org/mailman/listinfo/ckan-dev
>




More information about the ckan-dev mailing list