summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2013-04-20 11:13:49 -0500
committerDan McGee <dan@archlinux.org>2013-04-20 11:13:49 -0500
commit6de0cfbd23aae69036439db817cc26740d8796cd (patch)
treea7e1494b080e84961a1f35f05102950489cadbb0
parentb519c40e0af5b86ba660cf9d9cfc53a66fd8bef8 (diff)
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.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/mirrors/utils.py b/mirrors/utils.py
index 531cf005..ba45da5f 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}