Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1981)

Unified Diff: my_activity.py

Issue 204013009: my_activity.py: Parse rietveld dates without milliseconds. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: my_activity.py
diff --git a/my_activity.py b/my_activity.py
index 33694eba48ef50c364159257385cce52393c9083..48aeaea7b48b71a5277f9a138743779b9b918956 100755
--- a/my_activity.py
+++ b/my_activity.py
@@ -191,7 +191,12 @@ def datetime_from_gerrit(date_string):
def datetime_from_rietveld(date_string):
- return datetime.strptime(date_string, '%Y-%m-%d %H:%M:%S.%f')
+ try:
+ return datetime.strptime(date_string, '%Y-%m-%d %H:%M:%S.%f')
+ except ValueError:
+ # Sometimes rietveld returns a value without the milliseconds part, so we
+ # attempt to parse those cases as well.
+ return datetime.strptime(date_string, '%Y-%m-%d %H:%M:%S')
def datetime_from_google_code(date_string):
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698