changeset 431:8922713adbe6

getan-eval.py: Improves how 'user' is found.
author Bernhard Reiter <bernhard@intevation.de>
date Tue, 30 May 2017 09:01:12 +0200
parents e2b05afaf1bc
children 8d03d7ada7e1
files CHANGES getan/template.py scripts/getan-eval.py
diffstat 3 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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.)
 
--- 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):
--- 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)
 
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)