diff options
author | W. Trevor King <wking@drexel.edu> | 2011-04-14 20:44:02 -0400 |
---|---|---|
committer | W. Trevor King <wking@drexel.edu> | 2011-04-14 20:44:02 -0400 |
commit | b09cfb0cfecfb683e33490908b5ec59bed530938 (patch) | |
tree | 90b72cf2b36b593dec0837e23a884fa8c56d9d57 /libbe/ui/util/user.py | |
parent | 28b2fb89784f7a1f2dd61a4d157f6c511c5587fe (diff) | |
download | bugseverywhere-b09cfb0cfecfb683e33490908b5ec59bed530938.tar.gz |
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.
Diffstat (limited to 'libbe/ui/util/user.py')
-rw-r--r-- | libbe/ui/util/user.py | 5 |
1 files 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. |