[openstack-dev] OK to Use Flufl.enum

Adam Young ayoung at redhat.com
Fri Dec 13 20:41:14 UTC 2013


On 12/13/2013 05:17 AM, Yuriy Taraday wrote:
> Hello, Adam.
>
> On Tue, Dec 10, 2013 at 6:55 PM, Adam Young <ayoung at redhat.com 
> <mailto:ayoung at redhat.com>> wrote:
>
>     With only a change to the import and requirements, it builds and
>     runs, but raises:
>
>
>     Traceback (most recent call last):
>       File "keystone/tests/test_revoke.py", line 65, in
>     test_list_is_sorted
>         valid_until=valid_until))
>       File "keystone/contrib/revoke/core.py", line 74, in __init__
>         setattr(self, k, v)
>       File "keystone/contrib/revoke/core.py", line 82, in scope_type
>         self._scope_type = ScopeType[value]
>       File
>     "/opt/stack/keystone/.venv/lib/python2.7/site-packages/enum/__init__.py",
>     line 352, in __getitem__
>         return cls._member_map_[name]
>     KeyError: 1
>
>
> Looks like you're doing this the wrong way. Python 3.4's enums work 
> either as EnumClass(value) or as EnumClass[name], not as 
> EnumClass[value] as it seems your test is doing and flufl is allowing 
> it to.
>
> -- 
>
> Kind regards, Yuriy.
>
>
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Yep,  figured that out, but thanks for the pointer.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20131213/d9e8b318/attachment.html>


More information about the OpenStack-dev mailing list