[openstack-dev] OK to Use Flufl.enum

Yuriy Taraday yorik.sar at gmail.com
Fri Dec 13 10:17:40 UTC 2013


Hello, Adam.

On Tue, Dec 10, 2013 at 6:55 PM, Adam Young <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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20131213/13f0e193/attachment.html>


More information about the OpenStack-dev mailing list