Hey folks,
Mailman stores user_ids as UUIDs in the database, and they are converted on
the fly to integers by the REST API.
However, the mailmanclient library do not convert them back to UUID. Do you
think this is something that it should do, or should I handle this
conversion in my own code?
FYI, I'm attaching a very simple patch which does this conversion in
mailmanclient (4 lines changed).
Aurélien
=== modified file 'src/mailmanclient/_client.py'
--- src/mailmanclient/_client.py 2014-04-22 12:35:29 +0000
+++ src/mailmanclient/_client.py 2014-10-27 15:35:08 +0000
@@ -27,6 +27,7 @@
import re
import json
+from uuid import UUID
from base64 import b64encode
from httplib2 import Http
@@ -644,7 +645,7 @@
@property
def addresses(self):
- return _Addresses(self._connection, self.user_id)
+ return _Addresses(self._connection, self.user_id.int)
@property
def display_name(self):
@@ -668,7 +669,7 @@
@property
def user_id(self):
self._get_info()
- return self._info['user_id']
+ return UUID(int=self._info['user_id'])
@property
def created_on(self):
@@ -708,7 +709,7 @@
@property
def preferences(self):
if self._preferences is None:
- path = 'users/{0}/preferences'.format(self.user_id)
+ path = 'users/{0}/preferences'.format(self.user_id.int)
self._preferences = _Preferences(self._connection, path)
return self._preferences
_______________________________________________
Mailman-Developers mailing list
[email protected]
https://mail.python.org/mailman/listinfo/mailman-developers
Mailman FAQ: http://wiki.list.org/x/AgA3
Searchable Archives:
http://www.mail-archive.com/mailman-developers%40python.org/
Unsubscribe:
https://mail.python.org/mailman/options/mailman-developers/archive%40jab.org
Security Policy: http://wiki.list.org/x/QIA9