[Getan-commits] [PATCH 2 of 3] getan-eval.py: Improves how 'user' is found

Wald Commits scm-commit at wald.intevation.org
Tue May 30 09:05:03 CEST 2017


# HG changeset patch
# User Bernhard Reiter <bernhard at intevation.de>
# Date 1496127672 -7200
# Node ID 8922713adbe6af2d08cf185c74bf4403c082066d
# Parent  e2b05afaf1bcd34fcfb4e431e40cddce30532a73
getan-eval.py: Improves how 'user' is found.

diff -r e2b05afaf1bc -r 8922713adbe6 CHANGES
--- a/CHANGES	Tue May 30 08:48:36 2017 +0200
+++ b/CHANGES	Tue May 30 09:01:12 2017 +0200
@@ -1,5 +1,10 @@
 2.1 xx.xx.20xx UNRELEASED
 
+ * Improves how the 'user' is found: If no -u/--user is given uses
+   the environment variable $USER or the string 'USER'. Patch by Tom Gottfried.
+   (Bernhard Reiter)
+
+
 2.0 03.05.2017
 (Honoring Björn Ricks who did 90% of this release's development work.)
 
diff -r e2b05afaf1bc -r 8922713adbe6 getan/template.py
--- a/getan/template.py	Tue May 30 08:48:36 2017 +0200
+++ b/getan/template.py	Tue May 30 09:01:12 2017 +0200
@@ -64,7 +64,7 @@
 def render(template, database=None, year=None, week=None, project=None,
            user=None, empty_projects=True):
     if not user:
-        user = os.getenv("USER")
+        user = os.getenv("USER") or "USER"
 
     if not database:
         if os.path.isfile(DEFAULT_DATABASE):
diff -r e2b05afaf1bc -r 8922713adbe6 scripts/getan-eval.py
--- a/scripts/getan-eval.py	Tue May 30 08:48:36 2017 +0200
+++ b/scripts/getan-eval.py	Tue May 30 09:01:12 2017 +0200
@@ -54,6 +54,7 @@
     Writer = codecs.getwriter(encoding)
     sys.stdout = Writer(sys.stdout)
 
+    user = None
     if options.user:
         user = options.user.decode(encoding)
 


More information about the Getan-commits mailing list