aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/ui/util/user.py
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2009-12-13 06:19:23 -0500
committerW. Trevor King <wking@drexel.edu>2009-12-13 06:19:23 -0500
commit4d057dab603f42ec40b911dbee6792dcf107bd14 (patch)
tree9a73459aa160e3c96f4893b132543f412ca6e97f /libbe/ui/util/user.py
parentdff6bd9bf89ca80e2265696a478e540476718c9c (diff)
downloadbugseverywhere-4d057dab603f42ec40b911dbee6792dcf107bd14.tar.gz
Converted libbe.storage.vcs.base to new Storage format.
Diffstat (limited to 'libbe/ui/util/user.py')
-rw-r--r--libbe/ui/util/user.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/libbe/ui/util/user.py b/libbe/ui/util/user.py
index de2138c..64eb30c 100644
--- a/libbe/ui/util/user.py
+++ b/libbe/ui/util/user.py
@@ -7,6 +7,10 @@ example,
Note that the Arch VCS backend *enforces* ids with this format.
"""
+import re
+from socket import gethostname
+
+import libbe
import libbe.storage.util.config
def _get_fallback_username(self):
@@ -23,11 +27,11 @@ def _get_fallback_email(self):
name = _get_fallback_username()
return "%s@%s" % (name, hostname)
-def create_user_id(self, name, email=None):
+def create_user_id(name, email=None):
"""
- >>> create_id("John Doe", "jdoe@example.com")
+ >>> create_user_id("John Doe", "jdoe@example.com")
'John Doe <jdoe@example.com>'
- >>> create_id("John Doe")
+ >>> create_user_id("John Doe")
'John Doe'
"""
assert len(name) > 0
@@ -36,14 +40,14 @@ def create_user_id(self, name, email=None):
else:
return "%s <%s>" % (name, email)
-def parse_user_id(self, value):
+def parse_user_id(value):
"""
- >>> parse_id("John Doe <jdoe@example.com>")
+ >>> parse_user_id("John Doe <jdoe@example.com>")
('John Doe', 'jdoe@example.com')
- >>> parse_id("John Doe")
+ >>> parse_user_id("John Doe")
('John Doe', None)
>>> try:
- ... parse_id("John Doe <jdoe@example.com><what?>")
+ ... parse_user_id("John Doe <jdoe@example.com><what?>")
... except AssertionError:
... print "Invalid match"
Invalid match