get_fallback_email() now uses the EMAIL environmental variable (if set).
authorW. Trevor King <wking@drexel.edu>
Fri, 15 Apr 2011 00:44:02 +0000 (20:44 -0400)
committerW. Trevor King <wking@drexel.edu>
Fri, 15 Apr 2011 00:44:02 +0000 (20:44 -0400)
This patch is based on Julien Muchembled's suggestions, which are in
turn based on the related Git code in git.git/ident.c.

libbe/ui/util/user.py

index f2c7511d578966ad7096397b581525ca787cc634..10b2b968d4ac07d69d8b9b5f90497f2c20ac225c 100644 (file)
@@ -73,9 +73,8 @@ def get_fallback_fullname():
 def get_fallback_email():
     """Return an email address extracted from environmental variables.
     """
-    hostname = gethostname()
-    name = get_fallback_username()
-    return "%s@%s" % (name, hostname)
+    return os.getenv('EMAIL') or '%s@%s' % (
+        get_fallback_username(), gethostname())
 
 def create_user_id(name, email=None):
     """Create a user ID string from given `name` and `email` strings.