Merge lp:~salgado/launchpad/bug-937310 into lp:launchpad

Proposed by Guilherme Salgado
Status: Merged
Approved by: Curtis Hovey
Approved revision: no longer in the source branch.
Merged at revision: 14848
Proposed branch: lp:~salgado/launchpad/bug-937310
Merge into: lp:launchpad
Diff against target: 32 lines (+14/-0)
2 files modified
lib/lp/registry/browser/person.py (+7/-0)
lib/lp/registry/stories/location/personlocation-edit.txt (+7/-0)
To merge this branch: bzr merge lp:~salgado/launchpad/bug-937310
Reviewer Review Type Date Requested Status
Curtis Hovey (community) code Approve
Review via email: mp+93987@code.launchpad.net

Commit message

[r=sinzui][bug=937310] Use the person's time zone, when there is one, as the default value in +editlocation

Description of the change

Just use the person's time zone, when there is one, as the default value in the form. Previously this was done manually in the LocationWidget, which I removed.

To post a comment you must log in.
Revision history for this message
Curtis Hovey (sinzui) wrote :

Thank you.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/registry/browser/person.py'
2--- lib/lp/registry/browser/person.py 2012-02-19 14:44:47 +0000
3+++ lib/lp/registry/browser/person.py 2012-02-21 13:08:24 +0000
4@@ -4019,6 +4019,13 @@
5 page_title = label = 'Set timezone'
6
7 @property
8+ def initial_values(self):
9+ if self.context.time_zone is None:
10+ return {}
11+ else:
12+ return dict(time_zone=self.context.time_zone)
13+
14+ @property
15 def next_url(self):
16 return canonical_url(self.context)
17
18
19=== modified file 'lib/lp/registry/stories/location/personlocation-edit.txt'
20--- lib/lp/registry/stories/location/personlocation-edit.txt 2012-02-16 21:52:58 +0000
21+++ lib/lp/registry/stories/location/personlocation-edit.txt 2012-02-21 13:08:24 +0000
22@@ -29,3 +29,10 @@
23 >>> zzz.time_zone
24 u'Europe/Madrid'
25 >>> logout()
26+
27+And when he comes back to change it later, he'll see it there as the selected
28+value.
29+
30+ >>> self_browser.open('http://launchpad.dev/~zzz/+editlocation')
31+ >>> print self_browser.getControl(name='field.time_zone').value
32+ ['Europe/Madrid']