Merge lp:~vorlon/summit/strptime-usage into lp:summit

Proposed by Steve Langasek
Status: Needs review
Proposed branch: lp:~vorlon/summit/strptime-usage
Merge into: lp:summit
Diff against target: 33 lines (+8/-3)
2 files modified
summit/common/widgets.py (+6/-1)
summit/version.py (+2/-2)
To merge this branch: bzr merge lp:~vorlon/summit/strptime-usage
Reviewer Review Type Date Requested Status
Michael Hall (community) Needs Information
Review via email: mp+215540@code.launchpad.net

Description of the change

It's quite possible that I've done something wrong, but from what I can see the decompress() function fails consistently when trying to parse an existing datetime setting from the database because it will never be in HH:MM AM/PM form, but always HH:MM:SS. So this change is needed to make the form submission work for me.

To post a comment you must log in.
lp:~vorlon/summit/strptime-usage updated
223. By Steve Langasek

Apparently we can get this code path called with two different time formats; dunno why, but this addresses the problem at least for now

224. By Steve Langasek

Make the custom DateTime widget nullable, like the upstream one is

Revision history for this message
José Antonio Rey (jose) wrote :

Steve,

I think you wanted to push this against lp:summit/production instead of lp:summit?

Revision history for this message
Chris Johnston (cjohnston) wrote :

Why would we want to push code straight to production?
On Apr 12, 2014 6:30 PM, "José Antonio Rey" <email address hidden> wrote:

> Steve,
>
> I think you wanted to push this against lp:summit/production instead of
> lp:summit?
> --
> https://code.launchpad.net/~vorlon/summit/strptime-usage/+merge/215540
> Your team Summit Hackers is requested to review the proposed merge of
> lp:~vorlon/summit/strptime-usage into lp:summit.
>

Revision history for this message
Steve Langasek (vorlon) wrote :

On Sat, Apr 12, 2014 at 10:30:21PM -0000, José Antonio Rey wrote:
> I think you wanted to push this against lp:summit/production instead of lp:summit?

According to Michael, this is where it needs to be pushed.

Revision history for this message
José Antonio Rey (jose) wrote :

I was wondering because of the revision numbers. Also, the parent branch looks like production.

Revision history for this message
Michael Hall (mhall119) wrote :

When does the '%H:%M:%S' format get passed to this widget's decompress() method?

review: Needs Information

Unmerged revisions

224. By Steve Langasek

Make the custom DateTime widget nullable, like the upstream one is

223. By Steve Langasek

Apparently we can get this code path called with two different time formats; dunno why, but this addresses the problem at least for now

222. By Steve Langasek

Pass the right format string to strptime

I have no idea how this bug could have escaped notice for so long, but the
code is definitely unpacking a string in the wrong format. Fix a backtrace
when trying to submit registration forms for DebConf.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'summit/common/widgets.py'
--- summit/common/widgets.py 2013-04-08 20:50:49 +0000
+++ summit/common/widgets.py 2014-04-12 21:46:55 +0000
@@ -59,7 +59,10 @@
5959
60 def decompress(self, value):60 def decompress(self, value):
61 if isinstance(value, str):61 if isinstance(value, str):
62 value = strptime(value, '%I:%M %p')62 try:
63 value = strptime(value, '%H:%M:%S')
64 except ValueError:
65 value = strptime(value, '%I:%M %p')
63 hour = int(value.tm_hour)66 hour = int(value.tm_hour)
64 minute = int(value.tm_min)67 minute = int(value.tm_min)
65 if hour < 12:68 if hour < 12:
@@ -78,6 +81,8 @@
7881
79 def value_from_datadict(self, data, files, name):82 def value_from_datadict(self, data, files, name):
80 value = super(TimeWidget, self).value_from_datadict(data, files, name)83 value = super(TimeWidget, self).value_from_datadict(data, files, name)
84 if value[0] == None:
85 return None
81 t = strptime(86 t = strptime(
82 "%02d:%02d %s" % (87 "%02d:%02d %s" % (
83 int(value[0]),88 int(value[0]),
8489
=== modified file 'summit/version.py'
--- summit/version.py 2013-08-28 11:38:34 +0000
+++ summit/version.py 2014-04-12 21:46:55 +0000
@@ -1,2 +1,2 @@
1version = '1.2.14'1version = '1.2.16'
2revno = '560'2revno = '221'

Subscribers

People subscribed via source and target branches