Switching uuid4()[1:4] -> uuid4().hex[:4]
authorChristopher Allan Webber <cwebber@dustycloud.org>
Wed, 23 Jan 2013 21:15:22 +0000 (15:15 -0600)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Wed, 23 Jan 2013 21:15:22 +0000 (15:15 -0600)
.hex is what we need to access to get at the ascii (hex) version
anyway.  Also, not sure why the previous version grabbed starting at
the index of 1... just grab the first characters instead.

mediagoblin/db/mixin.py

index 0e000324964ed5e288fd210d90c84cadca996d52..c4c508a417cbb089ee1a5021d19954255db488ae 100644 (file)
@@ -111,7 +111,7 @@ class MediaEntryMixin(object):
             # let's whack junk on there till it's unique.
             self.slug += '-'
             while check_media_slug_used(self.uploader, self.slug, self.id):
-                self.slug += uuid4()[1:4]
+                self.slug += uuid4().hex[:4]
 
     @property
     def description_html(self):