diff options
author | Isis Lovecruft <isis@torproject.org> | 2013-01-31 02:37:19 +0000 |
---|---|---|
committer | Isis Lovecruft <isis@torproject.org> | 2013-01-31 02:37:19 +0000 |
commit | 29427dbba0cde178e4440148df5dc7a10765825d (patch) | |
tree | e3c37afbc717e988609be52975ab98c73a84911a /src | |
parent | 2d13c3be08a6fddc76258e375952314b4107cae5 (diff) |
Add UUID creator to alias_resolver.
Diffstat (limited to 'src')
-rw-r--r-- | src/leap/mx/alias_resolver.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/leap/mx/alias_resolver.py b/src/leap/mx/alias_resolver.py index 3d20ff7..da37314 100644 --- a/src/leap/mx/alias_resolver.py +++ b/src/leap/mx/alias_resolver.py @@ -12,6 +12,7 @@ Classes for resolving postfix aliases. ''' import os +import uuid try: from paisley import client @@ -30,6 +31,19 @@ except ImportError: from leap.mx import net, log ## xxx implement log +def createID(alias): + """ + Creates Universal Unique ID by taking the SHA-1 HASH of an email alias: + + >>> uuid.uuid5(uuid.NAMESPACE_URL, "isis@leap.se") + UUID('7194878e-4aea-563f-85a4-4f58519f3c4f') + + @param alias: An email address alias. + @returns: A :class:`uuid.UUID` containing attributes specifying the UUID. + """ + return uuid.uuid5(uuid.NAMESPACE_URL, str(alias)) + + class ConnectedCouchDB(client.CouchDB): """ Connect to a CouchDB instance. |