Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6dd8783

Browse files
committed
Improve getting the mailbox from the environment.
1 parent 56f78d9 commit 6dd8783

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

Lib/mailbox.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,12 @@ def _test():
142142

143143
args = sys.argv[1:]
144144
if not args:
145-
if os.environ.has_key('MAIL'):
146-
mbox = os.environ['MAIL']
147-
elif os.environ.has_key('MAIL'):
148-
mbox = os.environ['USER']
145+
for key in 'MAIL', 'LOGNAME', 'USER':
146+
if os.environ.has_key(key):
147+
mbox = os.environ[key]
148+
break
149149
else:
150-
print "Who are you?"
150+
print "$MAIL, $LOGNAME nor $USER set -- who are you?"
151151
return
152152
else:
153153
mbox = args[0]

0 commit comments

Comments
 (0)