The changes look good. Thanks for taking the time to make a lot of drive-by fixes.
I've got a few questions below.
--Brad
> === modified file 'lib/lp/registry/browser/person.py'
> --- lib/lp/registry/browser/person.py 2009-09-16 17:07:14 +0000
> +++ lib/lp/registry/browser/person.py 2009-09-16 21:19:47 +0000
> @@ -4086,6 +4086,8 @@
> custom_widget('mailing_list_auto_subscribe_policy',
> LaunchpadRadioWidgetWithDescription)
>
> + label = 'Change your e-mail settings'
> +
> def initialize(self):
> if self.context.is_team:
> # +editemails is not available on teams.
> @@ -4191,13 +4193,11 @@
> which the user is subscribed to this mailing list.
> """
> subscription = mailing_list.getSubscription(self.context)
> - if subscription is not None:
> - if subscription.email_address is None:
> - return "Preferred address"
> - else:
> - return subscription.email_address
> - else:
> + if subscription is None:
> return "Don't subscribe"
> + if subscription.email_address is None:
Hmm, I'd have used an elif.
> + return 'Preferred address'
> + return subscription.email_address
>
> def _mailing_list_fields(self):
> """Creates a field for each mailing list the user can subscribe to.
> @@ -4233,8 +4235,22 @@
> @property
> def mailing_list_widgets(self):
> """Return all the mailing list subscription widgets."""
> - return [widget for widget in self.widgets
> - if 'field.subscription.' in widget.name]
> + mailing_list_set = getUtility(IMailingListSet)
> + widgets = []
> + for widget in self.widgets:
> + if 'field.subscription.' in widget.name:
Why not use 'startswith'? Can it really be anywhere in the name?
> + team_name = widget.label
> + mailing_list = mailing_list_set.get(team_name)
> + assert mailing_list is not None, 'Missing mailing list'
> + widget_dict = dict(
> + team=mailing_list.team,
> + widget=widget,
> + )
> + widgets.append(widget_dict)
> + # We'll put the label in the first column, so don't include it
> + # in the second column.
> + widget.display_label = False
> + return widgets
>
> def _validate_selected_address(self, data, field='VALIDATED_SELECTED'):
> """A generic validator for this view's actions.
Hi Barry,
The changes look good. Thanks for taking the time to make a lot of drive-by fixes.
I've got a few questions below.
--Brad
> === modified file 'lib/lp/ registry/ browser/ person. py' registry/ browser/ person. py 2009-09-16 17:07:14 +0000 registry/ browser/ person. py 2009-09-16 21:19:47 +0000 widget( 'mailing_ list_auto_ subscribe_ policy' , idgetWithDescri ption) is_team: list.getSubscri ption(self. context) email_address is None: email_address email_address is None:
> --- lib/lp/
> +++ lib/lp/
> @@ -4086,6 +4086,8 @@
> custom_
> LaunchpadRadioW
>
> + label = 'Change your e-mail settings'
> +
> def initialize(self):
> if self.context.
> # +editemails is not available on teams.
> @@ -4191,13 +4193,11 @@
> which the user is subscribed to this mailing list.
> """
> subscription = mailing_
> - if subscription is not None:
> - if subscription.
> - return "Preferred address"
> - else:
> - return subscription.
> - else:
> + if subscription is None:
> return "Don't subscribe"
> + if subscription.
Hmm, I'd have used an elif.
> + return 'Preferred address' email_address list_fields( self): list_widgets( self): subscription. ' in widget.name] IMailingListSet ) subscription. ' in widget.name:
> + return subscription.
>
> def _mailing_
> """Creates a field for each mailing list the user can subscribe to.
> @@ -4233,8 +4235,22 @@
> @property
> def mailing_
> """Return all the mailing list subscription widgets."""
> - return [widget for widget in self.widgets
> - if 'field.
> + mailing_list_set = getUtility(
> + widgets = []
> + for widget in self.widgets:
> + if 'field.
Why not use 'startswith'? Can it really be anywhere in the name?
> + team_name = widget.label list_set. get(team_ name) list.team, append( widget_ dict) display_ label = False selected_ address( self, data, field=' VALIDATED_ SELECTED' ):
> + mailing_list = mailing_
> + assert mailing_list is not None, 'Missing mailing list'
> + widget_dict = dict(
> + team=mailing_
> + widget=widget,
> + )
> + widgets.
> + # We'll put the label in the first column, so don't include it
> + # in the second column.
> + widget.
> + return widgets
>
> def _validate_
> """A generic validator for this view's actions.
> === modified file 'lib/lp/ registry/ stories/ foaf/xx- setpreferredema il.txt' registry/ stories/ foaf/xx- setpreferredema il.txt 2008-09-08 13:35:16 +0000 registry/ stories/ foaf/xx- setpreferredema il.txt 2009-09-16 21:00:11 +0000 ======= ======= ======= ===== ======= ======= ======= =====
> --- lib/lp/
> +++ lib/lp/
> @@ -1,11 +1,14 @@
> -= A person's contact email address =
> +======
> +A person's contact email address
> +======
Thanks for converting this test.
> === modified file 'lib/lp/ registry/ stories/ mailinglists/ subscriptions. txt' registry/ stories/ mailinglists/ subscriptions. txt 2009-09-14 01:28:41 +0000 registry/ stories/ mailinglists/ subscriptions. txt 2009-09-16 21:00:11 +0000
> --- lib/lp/
> +++ lib/lp/
> === removed file 'lib/lp/ registry/ templates/ person- changepassword. pt'
Excellent!
> === modified file 'lib/lp/ registry/ templates/ person- editemails. pt' registry/ templates/ person- editemails. pt 2009-07-17 17:59:07 +0000 registry/ templates/ person- editemails. pt 2009-09-16 21:00:11 +0000 xml.zope. org/namespaces/ tal" xml.zope. org/namespaces/ metal" xml.zope. org/namespaces/ i18n" macro=" view/macro: page/onecolumn" macro=" view/macro: page/main_ only" "launchpad" slot="main" > macro=" context/ @@launchpad_ form/form" > "extra_ info"> "context/ preferredemail" > email"> "context/ preferredemail/ email" /></li> preferredemail" > contact- address" > "context/ preferredemail" > "context/ preferredemail/ email" /> preferredemail" contact- address" > "widgets" > "view/validated _addresses" > view/widgets/ VALIDATED_ SELECTED" > white-space: nowrap" >For this mailing list...</th> Subscribe with this address< /strong> </td> white-space: nowrap" >For mailing list</th>
> --- lib/lp/
> +++ lib/lp/
> @@ -3,35 +3,25 @@
> xmlns:tal="http://
> xmlns:metal="http://
> xmlns:i18n="http://
> - xml:lang="en"
> - lang="en"
> - dir="ltr"
> - metal:use-
> + metal:use-
> i18n:domain=
> >
> <body>
> <div metal:fill-
> <div metal:use-
> <metal:extra-info fill-slot=
> - <h1>Change your e-mail settings</h1>
> <h2>Your e-mail addresses</h2>
> - <tal:block condition=
> - <p>Your preferred contact address for all Launchpad e-mail is:</p>
> - <ul id="preferred-
> - <li class="mail"><b tal:content=
> - </ul>
> - </tal:block>
> -
> - <tal:block tal:condition="not: context/
> - <p id="no-
> - Currently you don't have a contact address in
> - Launchpad.
> - </p>
> - </tal:block>
> + <p tal:condition=
> + Your preferred contact address for all Launchpad e-mail is:
> + <b tal:content=
> + </p>
> + <p tal:condition="not: context/
> + id="no-
> + Currently you don't have a contact address in Launchpad.
> + </p>
> </metal:extra-info>
>
> <metal:widgets fill-slot=
> -
> <table class="form">
> <tal:validated tal:condition=
> <tal:widget define="widget nocall:
> @@ -87,24 +77,21 @@
> lists. You can subscribe to a team's mailing list using any of
> your verified email addresses.</p>
>
> - <table class="form">
> + <table class="listing" style="width: 45em;">
> <thead>
> - <th style="
> - <td><strong>
> + <th style="
Missing semi-colon
> + <th>Subscribe with</th> list_widgets" > "context/ @@launchpad_ form/widget_ row" /> "structure update_ subscriptions/ render" /> list_widgets" > "structure widget/ team/fmt: link">Team< /td> "structure widget/ widget" >Widget< /td> "structure view/action_ update_ subscriptions/ render" />
> </thead>
> <tbody>
> - <metal:block tal:repeat="widget view/mailing_
> - <metal:block use-macro=
> - </metal:block>
> - <tr>
> - <td></td>
> - <td>
> - <input tal:replace=
> - view/action_
> - </td>
> - </tr>
> + <tr tal:repeat="widget view/mailing_
> + <td tal:content=
> + <td tal:content=
> + </tr>
> </tbody>
> </table>
> + <div style="padding-top: 1em; padding-bottom: 1em;">
> + <input tal:replace=
> + </div>
> </form>
>
> <form action=""