[openstack-dev] [ALL] Removing generate_uuid() from uuidutils

Mark Washenberger mark.washenberger at markwash.net
Wed Nov 13 17:35:29 UTC 2013


On Wed, Nov 13, 2013 at 8:02 AM, Julien Danjou <julien at danjou.info> wrote:

> On Wed, Nov 13 2013, John Griffith wrote:
>
> > Trivial or not, people use it and frankly I don't see any value at all
> > in removing it.  As far as the "some projects want a different format
> > of UUID" that doesn't make a lot of sense to me but if that's what
> > somebody wants they should write their own method.  I strongly agree
> > with others with respect to the comments around code-churn.  I see
> > little value in this.
>
> The thing is that code in oslo-incubator is supposed to be graduated to
> standalone Python library.
>
> We see little value in a library providing a library for a helper doing
> str(uuid.uuid4()).
>

For the currently remaining function in uuidutils, is_uuid_like, could we
potentially just add this functionality to the standard library?
Something like:

>>> uuid.UUID('aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa')
UUID('aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa')
>>> uuid.UUID('aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa'.replace('-', ''))
UUID('aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa')
>>> uuid.UUID('aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa'.replace('-', ''),
strict=True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File
"/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/uuid.py",
line 134, in __init__
    raise ValueError('badly formed hexadecimal UUID string')
ValueError: badly formed hexadecimal UUID string

I've had a few situations where UUID's liberal treatment of what it
consumes has seemed a bit excessive, anyway. Not sure if this approach is a
bit too naive, however.



>
> --
> Julien Danjou
> /* Free Software hacker * independent consultant
>    http://julien.danjou.info */
>
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20131113/226ec919/attachment.html>


More information about the OpenStack-dev mailing list