diff options
author | Dan McGee <dan@archlinux.org> | 2013-04-20 18:13:49 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2013-04-20 18:13:49 +0200 |
commit | 6de0cfbd23aae69036439db817cc26740d8796cd (patch) | |
tree | a7e1494b080e84961a1f35f05102950489cadbb0 | |
parent | b519c40e0af5b86ba660cf9d9cfc53a66fd8bef8 (diff) | |
download | archweb-6de0cfbd23aae69036439db817cc26740d8796cd.tar.gz archweb-6de0cfbd23aae69036439db817cc26740d8796cd.tar.xz |
Fix some None issues with sqlite3 and mirror status
If certain attributes came back from the database as NULL, we had issues
parsing them. Pass None/NULL straight through rather than trying to
type-convert.
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r-- | mirrors/utils.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/mirrors/utils.py b/mirrors/utils.py index 531cf00..ba45da5 100644 --- a/mirrors/utils.py +++ b/mirrors/utils.py @@ -71,8 +71,10 @@ GROUP BY l.url_id, u.mirror_id # sqlite loves to return less than ideal types if vendor == 'sqlite': for item in url_data: - item['delay'] = timedelta(seconds=item['delay']) - item['last_sync'] = parse_datetime(item['last_sync']) + if item['delay'] is not None: + item['delay'] = timedelta(seconds=item['delay']) + if item['last_sync'] is not None: + item['last_sync'] = parse_datetime(item['last_sync']) item['last_check'] = parse_datetime(item['last_check']) return {item['url_id']: item for item in url_data} |