← Back to team overview

launchpad-reviewers team mailing list archive

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

 

Guilherme Salgado has proposed merging lp:~salgado/launchpad/bug-937310 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #937310 in Launchpad itself: "Person:+editlocation always defaults to UTC"
  https://bugs.launchpad.net/launchpad/+bug/937310

For more details, see:
https://code.launchpad.net/~salgado/launchpad/bug-937310/+merge/93987

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.
-- 
https://code.launchpad.net/~salgado/launchpad/bug-937310/+merge/93987
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~salgado/launchpad/bug-937310 into lp:launchpad.
=== modified file 'lib/lp/registry/browser/person.py'
--- lib/lp/registry/browser/person.py	2012-02-19 14:44:47 +0000
+++ lib/lp/registry/browser/person.py	2012-02-21 13:08:24 +0000
@@ -4019,6 +4019,13 @@
     page_title = label = 'Set timezone'
 
     @property
+    def initial_values(self):
+        if self.context.time_zone is None:
+            return {}
+        else:
+            return dict(time_zone=self.context.time_zone)
+
+    @property
     def next_url(self):
         return canonical_url(self.context)
 

=== modified file 'lib/lp/registry/stories/location/personlocation-edit.txt'
--- lib/lp/registry/stories/location/personlocation-edit.txt	2012-02-16 21:52:58 +0000
+++ lib/lp/registry/stories/location/personlocation-edit.txt	2012-02-21 13:08:24 +0000
@@ -29,3 +29,10 @@
     >>> zzz.time_zone
     u'Europe/Madrid'
     >>> logout()
+
+And when he comes back to change it later, he'll see it there as the selected
+value.
+
+    >>> self_browser.open('http://launchpad.dev/~zzz/+editlocation')
+    >>> print self_browser.getControl(name='field.time_zone').value
+    ['Europe/Madrid']