[Getan-commits] [PATCH 3 of 3] scripts/getan-report.py: also accepts YYYYMMDD as reportdate

Wald Commits scm-commit at wald.intevation.org
Fri Feb 3 17:36:01 CET 2017


# HG changeset patch
# User Bernhard Reiter <bernhard at intevation.de>
# Date 1486130466 -3600
# Node ID c272982799b580b830573ff548b9d11e022d054b
# Parent  f656d9370085c7722c9d726f2e989ff60b3c9229
scripts/getan-report.py: also accepts YYYYMMDD as reportdate.

diff -r f656d9370085 -r c272982799b5 scripts/getan-report.py
--- a/scripts/getan-report.py	Fri Feb 03 14:57:32 2017 +0100
+++ b/scripts/getan-report.py	Fri Feb 03 15:01:06 2017 +0100
@@ -82,8 +82,13 @@
     l.debug(args)
 
     if args.reportday:
-        report_range_start = \
-            datetime.datetime.strptime(args.reportday, "%Y-%m-%d")
+        try:
+            report_range_start = \
+                datetime.datetime.strptime(args.reportday, "%Y-%m-%d")
+        except ValueError:
+            report_range_start = \
+                datetime.datetime.strptime(args.reportday, "%Y%m%d")
+
     elif args.t:
         # start with today 00:00
         report_range_start = datetime.datetime.combine(


More information about the Getan-commits mailing list