From b09cfb0cfecfb683e33490908b5ec59bed530938 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Thu, 14 Apr 2011 20:44:02 -0400 Subject: [PATCH] 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. --- libbe/ui/util/user.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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. -- 2.26.2