From: W. Trevor King Date: Fri, 15 Apr 2011 00:44:02 +0000 (-0400) Subject: get_fallback_email() now uses the EMAIL environmental variable (if set). X-Git-Tag: 1.1.0~230 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b09cfb0cfecfb683e33490908b5ec59bed530938;p=be.git get_fallback_email() now uses the EMAIL environmental variable (if set). This patch is based on Julien Muchembled's suggestions, which are in turn based on the related Git code in git.git/ident.c. --- diff --git a/libbe/ui/util/user.py b/libbe/ui/util/user.py index f2c7511..10b2b96 100644 --- a/libbe/ui/util/user.py +++ b/libbe/ui/util/user.py @@ -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.