diff options
| author | Barry Warsaw | 2011-08-30 19:11:19 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2011-08-30 19:11:19 -0400 |
| commit | 0664713d4f7e30b0b56b1ce00ccf3367f416c901 (patch) | |
| tree | 7bc824930335b25aa5e13346992b4754f5ca1e64 /src/mailman/utilities/uid.py | |
| parent | 043562c695387a12e655997abf41cef77cb3d3a4 (diff) | |
| parent | 5a38df15cd6ca0619e0e987624457e0453425dce (diff) | |
| download | mailman-0664713d4f7e30b0b56b1ce00ccf3367f416c901.tar.gz mailman-0664713d4f7e30b0b56b1ce00ccf3367f416c901.tar.zst mailman-0664713d4f7e30b0b56b1ce00ccf3367f416c901.zip | |
* User and Member ids are now proper UUIDs. The UUIDs are pended as unicodes,
and exposed to the REST API as their integer equivalents. They are stored
in the database using Storm's UUID type.
- ISubscriptionService.get_member() now takes a UUID
- IUserManager.get_user_by_id() now takes a UUID
* Moderators and owners can be added via REST (LP: #834130). Given by
Stephen A. Goss.
- add_member() grows a `role` parameter.
- ISubscriptionService.join() grows a `role` parameter.
* InvalidEmailAddressError no longer repr()'s its value.
* `address` -> `email` for consistency
- delete_member()
- ISubscriptionService.leave()
* Fixed typo in app/subscriptions.py __all__
* AlreadySubscribedError: attributes are now public.
* More .txt -> .rst renames.
Diffstat (limited to 'src/mailman/utilities/uid.py')
| -rw-r--r-- | src/mailman/utilities/uid.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/mailman/utilities/uid.py b/src/mailman/utilities/uid.py index 7ef50ace0..dfbff0ae6 100644 --- a/src/mailman/utilities/uid.py +++ b/src/mailman/utilities/uid.py @@ -31,10 +31,10 @@ __all__ = [ import os +import uuid import errno from flufl.lock import Lock -from uuid import uuid4 from mailman.config import config from mailman.model.uid import UID @@ -71,7 +71,7 @@ class UniqueIDFactory: """Return a new UID. :return: The new uid - :rtype: unicode + :rtype: int """ if layers.is_testing(): # When in testing mode we want to produce predictable id, but we @@ -84,7 +84,7 @@ class UniqueIDFactory: # tests) that it will not be a problem. Maybe. return self._next_uid() while True: - uid = unicode(uuid4().hex, 'us-ascii') + uid = uuid.uuid4() try: UID.record(uid) except ValueError: @@ -96,17 +96,17 @@ class UniqueIDFactory: with self._lock: try: with open(self._uid_file) as fp: - uid = fp.read().strip() - next_uid = int(uid) + 1 + uid = int(fp.read().strip()) + next_uid = uid + 1 with open(self._uid_file, 'w') as fp: fp.write(str(next_uid)) + return uuid.UUID(int=uid) except IOError as error: if error.errno != errno.ENOENT: raise with open(self._uid_file, 'w') as fp: fp.write('2') - return '1' - return unicode(uid, 'us-ascii') + return uuid.UUID(int=1) def reset(self): with self._lock: |
