[PonyORM-list] Bug with filter() ?

Alexander Kozlovsky alexander.kozlovsky at gmail.com
Tue Nov 17 08:44:46 UTC 2015


Hi Matthew! Thanks for the reporting!

I fixed the issue and pushed the fix to the GitHub. In order to make your
code work, you need to place the `u` prefix both before the string passed
to the filter() function and before the unicode literal inside the string:

    models.Order.select().filter(u'u"ö" in o.user.email')

With the provided fix, this should work fine.


Regards,
Alexander


On Tue, Nov 17, 2015 at 1:39 AM, Matthew Bell <matthewrobertbell at gmail.com>
wrote:

> Hello,
>
> A query like this works fine:
>
> models.Order.select().filter('"x" in o.user.email')
>
> However, using an accented character, I have difficulties:
>
> models.Order.select().filter('"ö" in o.user.email')
> ExprEvalError: '\xc3\xb6' in o.user.email raises NameError: name 'o' is
> not defined
>
> or
>
> models.Order.select().filter(u'"ö" in o.user.email')
> UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in
> position 2: ordinal not in range(128)
>
> This happens in SQLite and postgres. Am I doing something wrong?
>
> Thanks
> --
> Regards,
>
> Matthew Bell
>
> _______________________________________________
> ponyorm-list mailing list
> ponyorm-list at ponyorm.com
> /ponyorm-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </ponyorm-list/attachments/20151117/b289aae3/attachment.html>


More information about the ponyorm-list mailing list