[storm] Invalid enum value on find

Vincent Alquier vincent.alquier at gmail.com
Wed Apr 3 15:10:02 UTC 2013


Hi,

Didn't try, but I think you should define your enum using the python
unicode style...

card_type = Enum(map={
            u'VISA': 1, u'MC': 2, u'LASER': 3, u'AMEX': 4,
            u'DINERS': 5, u'DELTA': 6, u'MAESTRO': 7
        })

Hope this helps



2013/4/3 Oscar Campos <oscar.campos at open-phoenix.com>

> Hi all.
>
> I have an enumeration defined in the usual way:
>     class Card(Storm):
>         __storm_table__ = 'b2c_credit_cards'
>         ...
>         card_type = Enum(map={
>             'VISA': 1, 'MC': 2, 'LASER': 3, 'AMEX': 4,
>             'DINERS': 5, 'DELTA': 6, 'MAESTRO': 7
>         })
>         ...
>
> If I create a new Card object I can flush the store and commit without
> any problem, of course I am able to use card.card_type = 'VISA' but when
> I try to load it from the database I always get a ValueError exception
> like "Invalid enum value u:'VISA' (or whatever other card type I did
> store first)"
>
> I'm using MySQL 5.1.66, Storm 0.19 and Python 2.7.3
>
> Someone have any idea about how to solve this?
>
> Best Regards.
>
> --
> storm mailing list
> storm at lists.canonical.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/storm
>



-- 
Vincent Alquier
vincent.alquier at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/storm/attachments/20130403/353d158e/attachment.html>


More information about the storm mailing list