<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 12/10/2013 05:24 AM, Flavio Percoco
wrote:<br>
</div>
<blockquote cite="mid:20131210102417.GC969@redhat.com" type="cite">On
09/12/13 19:45 -0800, Alex Gaynor wrote:
<br>
<blockquote type="cite">Would it make sense to use the `enum34`
package, which is a backport of teh
<br>
enum package from py3k?
<br>
</blockquote>
<br>
+1
<br>
<br>
This is what we were using in Marconi.
<br>
</blockquote>
So... they seem to be doing something different from Flufl, as
IntEnums are not working the same way. I wonder if it is just
update lag, and Flufl is the Upstream for the changes.<br>
<br>
With only a change to the import and requirements, it builds and
runs, but raises:<br>
<br>
<br>
Traceback (most recent call last):<br>
File "keystone/tests/test_revoke.py", line 65, in
test_list_is_sorted<br>
valid_until=valid_until))<br>
File "keystone/contrib/revoke/core.py", line 74, in __init__<br>
setattr(self, k, v)<br>
File "keystone/contrib/revoke/core.py", line 82, in scope_type<br>
self._scope_type = ScopeType[value]<br>
File
"/opt/stack/keystone/.venv/lib/python2.7/site-packages/enum/__init__.py",
line 352, in __getitem__<br>
return cls._member_map_[name]<br>
KeyError: 1<br>
<br>
<br>
This seems to say that you cannot access an IntEnum as an integer,
which just seems broken.<br>
<br>
<br>
<blockquote cite="mid:20131210102417.GC969@redhat.com" type="cite">
<br>
<blockquote type="cite">
<br>
Alex
<br>
<br>
<br>
On Mon, Dec 9, 2013 at 7:37 PM, Adam Young
<a class="moz-txt-link-rfc2396E" href="mailto:ayoung@redhat.com"><ayoung@redhat.com></a> wrote:
<br>
<br>
While Python 3 has enumerated types, Python 2 does not, and
the standard
<br>
package to provide id, Flufl.enum, is not yet part of our
code base. Is
<br>
there any strong objection to including Flufl.enum?
<br>
<br>
<a class="moz-txt-link-freetext" href="http://pythonhosted.org/flufl.enum/">http://pythonhosted.org/flufl.enum/</a>
<br>
<br>
It makes for some very elegant code, especially for
enumerated integer
<br>
types.
<br>
<br>
For an example See ScopeType in
<br>
<br>
<a class="moz-txt-link-freetext" href="https://review.openstack.org/#/c/55908/4/keystone/contrib/revoke/core.py">https://review.openstack.org/#/c/55908/4/keystone/contrib/revoke/core.py</a>
<br>
<br>
Line 62.
<br>
<br>
the getter/setter in RevokeEvent do not need to do any
conditional logic if
<br>
passed either an integer or a ScopeType.
<br>
<br>
<br>
_______________________________________________
<br>
OpenStack-dev mailing list
<br>
<a class="moz-txt-link-abbreviated" href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a>
<br>
<a class="moz-txt-link-freetext" href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a>
<br>
<br>
<br>
<br>
<br>
--
<br>
"I disapprove of what you say, but I will defend to the death
your right to say
<br>
it." -- Evelyn Beatrice Hall (summarizing Voltaire)
<br>
"The people's good is the highest law." -- Cicero
<br>
GPG Key fingerprint: 125F 5C67 DFE9 4084
<br>
</blockquote>
<br>
<blockquote type="cite">_______________________________________________
<br>
OpenStack-dev mailing list
<br>
<a class="moz-txt-link-abbreviated" href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a>
<br>
<a class="moz-txt-link-freetext" href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a>
<br>
</blockquote>
<br>
<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
OpenStack-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a>
<a class="moz-txt-link-freetext" href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a>
</pre>
</blockquote>
<br>
</body>
</html>