Merge lp:~dannf/laika/lp929049 into lp:laika

Proposed by dann frazier on 2012-02-28
Status: Merged
Merged at revision: 19
Proposed branch: lp:~dannf/laika/lp929049
Merge into: lp:laika
Diff against target: 36 lines (+11/-2)
1 file modified
laika (+11/-2)
To merge this branch: bzr merge lp:~dannf/laika/lp929049
Reviewer Review Type Date Requested Status
Alex Chiang 2012-02-28 Approve on 2012-03-08
Review via email: mp+94898@code.launchpad.net
To post a comment you must log in.
Alex Chiang (achiang) wrote :

Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'laika'
2--- laika 2011-11-25 07:59:12 +0000
3+++ laika 2012-02-28 02:01:30 +0000
4@@ -23,6 +23,13 @@
5
6 UTCNOW = datetime.datetime.utcnow()
7
8+def lpdate2date(lpdate):
9+ try:
10+ dt = datetime.datetime.strptime(lpdate.split('.')[0], '%Y-%m-%dT%H:%M:%S')
11+ return dt
12+ except ValueError:
13+ return None
14+
15 class LPWrap:
16 '''Simple wrapper Cache-Proxy for LP objects'''
17 def __init__(self, lpObj):
18@@ -84,7 +91,9 @@
19 http://www.enricozini.org/2009/debian/using-python-datetime/
20 '''
21 win = datetime.timedelta(self.window)
22- date = date.replace(tzinfo=None)
23+ date = lpdate2date(date)
24+ if date == None:
25+ return False
26 delta = UTCNOW - date
27 return delta <= win
28
29@@ -92,7 +101,7 @@
30 '''Using this interface adds the bug to global bug list.'''
31 ago = ""
32 self.bugs[task.bug.id] = 1
33- delta = UTCNOW - task.bug.date_last_updated.replace(tzinfo=None)
34+ delta = UTCNOW - lpdate2date(task.bug.date_last_updated)
35 if delta.days > 0:
36 ago = "%d day%s" % (delta.days, "s" if delta.days > 1 else "")
37

Subscribers

People subscribed via source and target branches