webapp: parse rounded timestamps
[~helmut/crossqa.git] / webapp.py
index b9558cd..9e69a18 100644 (file)
--- a/webapp.py
+++ b/webapp.py
@@ -90,7 +90,10 @@ src_template = """<!DOCTYPE html>
 
 @app.template_filter("sqltimestamp")
 def sqltimestamp_filter(s):
-    return datetime.datetime.strptime(s, "%Y-%m-%d %H:%M:%S.%f")
+    try:
+        return datetime.datetime.strptime(s, "%Y-%m-%d %H:%M:%S.%f")
+    except ValueError:
+        return datetime.datetime.strptime(s, "%Y-%m-%d %H:%M:%S")
 
 @app.template_filter("formatts")
 def formatts_filter(ts):