Mercurial > ~darius > hgwebdir.cgi > agl
changeset 15:7fd3dc0516f8
Do some option sanity checking.
author | Daniel O'Connor <darius@dons.net.au> |
---|---|
date | Mon, 11 Sep 2017 22:14:37 +0930 |
parents | db4951d2d303 |
children | 201ad77bac40 |
files | agl.py |
diffstat | 1 files changed, 6 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/agl.py Mon Sep 11 22:09:37 2017 +0930 +++ b/agl.py Mon Sep 11 22:14:37 2017 +0930 @@ -44,6 +44,9 @@ if not args.update and not args.graph: parser.error('Nothing to do') + if args.days is not None and args.days < 0: + parser.error('days must be non-negative') + start = args.start if start is None: start = datetime.date.today() @@ -57,6 +60,9 @@ end = start + datetime.timedelta(days = 1) end = datetime.datetime(end.year, end.month, end.day) + if start >= end: + parser.error('Start must be before end') + dbh = sqlite3.connect(dbfn, detect_types = sqlite3.PARSE_DECLTYPES) cur = dbh.cursor() if args.update: