Mercurial > getan
comparison scripts/getan-eval.py @ 429:5ee2ce059338
getan-eval.py: improves diagnosis.
* (minor) In case of missing -u/--user parameter, scripts/getan-eval.py
will output an error message.
author | Bernhard Reiter <bernhard@intevation.de> |
---|---|
date | Mon, 29 May 2017 14:22:06 +0200 |
parents | da9a400848fd |
children | e2b05afaf1bc |
comparison
equal
deleted
inserted
replaced
428:7adc6cd9d23a | 429:5ee2ce059338 |
---|---|
20 parser = OptionParser() | 20 parser = OptionParser() |
21 parser.add_option("-d", "--database", dest="database", | 21 parser.add_option("-d", "--database", dest="database", |
22 help="getan database", metavar="DATABASE") | 22 help="getan database", metavar="DATABASE") |
23 parser.add_option("-t", "--template", dest="template", metavar="TEMPLATE", | 23 parser.add_option("-t", "--template", dest="template", metavar="TEMPLATE", |
24 help="name of getan template") | 24 help="name of getan template") |
25 parser.add_option("-u", "--user", dest="user", help="name of user") | 25 parser.add_option("-u", "--user", dest="user", |
26 help="[REQUIRED] name of user") | |
26 parser.add_option("-p", "--project", dest="project", | 27 parser.add_option("-p", "--project", dest="project", |
27 help="key of output project") | 28 help="key of output project") |
28 parser.add_option("-w", "--week", type="int", dest="week", | 29 parser.add_option("-w", "--week", type="int", dest="week", |
29 help="week of year") | 30 help="week of year") |
30 parser.add_option("-y", "--year", type="int", dest="year", help="year") | 31 parser.add_option("-y", "--year", type="int", dest="year", help="year") |
54 Writer = codecs.getwriter(encoding) | 55 Writer = codecs.getwriter(encoding) |
55 sys.stdout = Writer(sys.stdout) | 56 sys.stdout = Writer(sys.stdout) |
56 | 57 |
57 if options.user: | 58 if options.user: |
58 user = options.user.decode(encoding) | 59 user = options.user.decode(encoding) |
60 else: | |
61 parser.error("You have to give the -u/--user parameter.") | |
59 | 62 |
60 print render(database=options.database, user=user, | 63 print render(database=options.database, user=user, |
61 template=template_name, year=year, week=week, | 64 template=template_name, year=year, week=week, |
62 project=options.project, empty_projects=options.empty) | 65 project=options.project, empty_projects=options.empty) |
63 | 66 |