Merge lp:~sinzui/launchpad/lost-glob-bug-484365 into lp:launchpad

Proposed by Curtis Hovey
Status: Merged
Merged at revision: not available
Proposed branch: lp:~sinzui/launchpad/lost-glob-bug-484365
Merge into: lp:launchpad
Diff against target: 213 lines (+68/-21)
8 files modified
lib/lp/registry/browser/product.py (+2/-1)
lib/lp/registry/browser/tests/packaging-views.txt (+4/-4)
lib/lp/registry/browser/tests/product-views.txt (+23/-0)
lib/lp/registry/doc/productseries.txt (+11/-1)
lib/lp/registry/interfaces/packaging.py (+8/-8)
lib/lp/registry/interfaces/product.py (+14/-3)
lib/lp/registry/interfaces/sourcepackage.py (+1/-1)
lib/lp/registry/model/product.py (+5/-3)
To merge this branch: bzr merge lp:~sinzui/launchpad/lost-glob-bug-484365
Reviewer Review Type Date Requested Status
Michael Nelson (community) code Approve
Review via email: mp+15025@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Curtis Hovey (sinzui) wrote :

This is my branch to fix the +addseries view to save the release file glob.

    lp:~sinzui/launchpad/lost-glob-bug-484365
    Diff size: 116
    Launchpad bug: https://bugs.launchpad.net/bugs/484365
    Test command: ./bin/test -vv -t product-views -t productseries.txt
    Pre-implementation: kiko
    Target release: 3.1.11

= Fix the +addseries view to save the release file glob =

The ProductAddSeriesView.add_action does not pass the releasefileglob glob
to the constructor.

== Rules ==

    * Update ProductAddSeriesView.add_action to pass the releasefileglob
      field to the constructor.
    * Update Product.newSeries() to support the releasefileglob argument.

== QA ==

    * On staging, create a series with a releasefileglob
    * Verify the glob is listed on the series page.

== Lint ==

Linting changed files:
  lib/lp/registry/browser/product.py
  lib/lp/registry/browser/tests/product-views.txt
  lib/lp/registry/doc/productseries.txt
  lib/lp/registry/interfaces/product.py
  lib/lp/registry/model/product.py

== Test ==

    * lib/lp/registry/browser/tests/product-views.txt
      * Added a test to verify the fields are accepted by the +addseries
        view.
    * lib/lp/registry/doc/productseries.txt
      * Updated doctest to show that the releasefileglob and verify the
        pertinent info is set.

== Implementation ==

    * lib/lp/registry/browser/product.py
      * Updated the view to pass the releasefileglob to product.newSeries()
    * lib/lp/registry/interfaces/product.py
      * Added the releasefileglob argument to newSeries()
      * Fixed a long line reported by lint.
    * lib/lp/registry/model/product.py
      * Added the releasefileglob argument to the newSeries() method.

Revision history for this message
Michael Nelson (michael.nelson) wrote :

Wow - you always do such clean branches Curtis - it's great to review!

The only comment I could make is actually in the form of Barry's voice in my head - whether you want to take the time to add the doc params to IProductDriverRestricted.newSeries().

Thanks!

review: Approve (code)
Revision history for this message
Curtis Hovey (sinzui) wrote :

On Thu, 2009-11-19 at 15:46 +0000, Michael Nelson wrote:
> Review: Approve code
> Wow - you always do such clean branches Curtis - it's great to review!
>
> The only comment I could make is actually in the form of Barry's voice
> in my head - whether you want to take the time to add the doc params
> to IProductDriverRestricted.newSeries().

I agree.

--- lib/lp/registry/interfaces/product.py 2009-11-19 04:39:48 +0000
+++ lib/lp/registry/interfaces/product.py 2009-11-19 16:18:54 +0000
@@ -273,7 +273,17 @@
     """`IProduct` properties which require launchpad.Driver permission."""

     def newSeries(owner, name, summary, branch=None, releasefileglob=None):
- """Creates a new ProductSeries for this product."""
+ """Creates a new `IProductSeries` for this `IProduct`.
+
+ :param owner: The registrant of this series.
+ :param name: The unique name of this series.
+ :param summary: The summary of the purpose and focus of development
+ of this series.
+ :param branch: The bazaar branch that contains the code for
+ this series.
+ :param releasefileglob: The public URL pattern where release files can
+ be automatically downloaded from and linked to this series.
+ """

 class IProductEditRestricted(IOfficialBugTagTargetRestricted,):

--
__Curtis C. Hovey_________
http://launchpad.net/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/registry/browser/product.py'
2--- lib/lp/registry/browser/product.py 2009-11-19 07:45:09 +0000
3+++ lib/lp/registry/browser/product.py 2009-11-19 22:21:17 +0000
4@@ -1307,7 +1307,8 @@
5 owner=self.user,
6 name=data['name'],
7 summary=data['summary'],
8- branch=data['branch'])
9+ branch=data['branch'],
10+ releasefileglob=data['releasefileglob'])
11
12 @property
13 def next_url(self):
14
15=== modified file 'lib/lp/registry/browser/tests/packaging-views.txt'
16--- lib/lp/registry/browser/tests/packaging-views.txt 2009-10-26 19:09:39 +0000
17+++ lib/lp/registry/browser/tests/packaging-views.txt 2009-11-19 22:21:17 +0000
18@@ -43,7 +43,7 @@
19 >>> form = {
20 ... 'field.distroseries': 'ubuntu/hoary',
21 ... 'field.sourcepackagename': 'hot',
22- ... 'field.packaging': 'Primary Product',
23+ ... 'field.packaging': 'Primary Project',
24 ... 'field.actions.continue': 'Continue',
25 ... }
26 >>> view = create_initialized_view(
27@@ -61,7 +61,7 @@
28 >>> form = {
29 ... 'field.distroseries': 'ubuntu/hoary',
30 ... 'field.sourcepackagename': 'hot',
31- ... 'field.packaging': 'Primary Product',
32+ ... 'field.packaging': 'Primary Project',
33 ... 'field.actions.continue': 'Continue',
34 ... }
35 >>> view = create_initialized_view(
36@@ -78,7 +78,7 @@
37 >>> form = {
38 ... 'field.distroseries': 'ubuntu/hoary',
39 ... 'field.sourcepackagename': 'hot',
40- ... 'field.packaging': 'Primary Product',
41+ ... 'field.packaging': 'Primary Project',
42 ... 'field.actions.continue': 'Continue',
43 ... }
44 >>> view = create_initialized_view(
45@@ -93,7 +93,7 @@
46 >>> form = {
47 ... 'field.distroseries': 'ubuntu/hoary',
48 ... 'field.sourcepackagename': '',
49- ... 'field.packaging': 'Primary Product',
50+ ... 'field.packaging': 'Primary Project',
51 ... 'field.actions.continue': 'Continue',
52 ... }
53 >>> view = create_initialized_view(
54
55=== modified file 'lib/lp/registry/browser/tests/product-views.txt'
56--- lib/lp/registry/browser/tests/product-views.txt 2009-08-31 21:20:55 +0000
57+++ lib/lp/registry/browser/tests/product-views.txt 2009-11-19 22:21:17 +0000
58@@ -345,6 +345,29 @@
59 >>> print view.cancel_url
60 http://launchpad.dev/firefox
61
62+The view allows the driver to set series name, summary, branch and
63+releasefileglob fields.
64+
65+ >>> view.field_names
66+ ['name', 'summary', 'branch', 'releasefileglob']
67+
68+ >>> form = {
69+ ... 'field.name': 'master',
70+ ... 'field.summary': 'The primary development series.',
71+ ... 'field.releasefileglob': 'ftp://mozilla.org/firefox.*bz2',
72+ ... 'field.branch': '',
73+ ... 'field.actions.add': 'Register Series',
74+ ... }
75+ >>> view = create_initialized_view(firefox, name='+addseries', form=form)
76+ >>> print view.series.name
77+ master
78+
79+ >>> print view.series.summary
80+ The primary development series.
81+
82+ >>> print view.series.releasefileglob
83+ ftp://mozilla.org/firefox.*bz2
84+
85
86 Product index view
87 ==================
88
89=== modified file 'lib/lp/registry/doc/productseries.txt'
90--- lib/lp/registry/doc/productseries.txt 2009-10-26 18:40:04 +0000
91+++ lib/lp/registry/doc/productseries.txt 2009-11-19 22:21:17 +0000
92@@ -73,7 +73,17 @@
93 Unauthorized: (..., 'newSeries', 'launchpad.Driver')
94
95 >>> login_person(firefox.owner)
96- >>> emacs_series = firefox.newSeries(firefox.owner , 'emacs', summary)
97+ >>> emacs_series = firefox.newSeries(
98+ ... firefox.owner , 'emacs', summary,
99+ ... releasefileglob='ftp://gnu.org/emacs*.gz')
100+ >>> print emacs_series.name
101+ emacs
102+
103+ >>> print emacs_series.summary
104+ Port of Firefox to the Emacs operating system.
105+
106+ >>> print emacs_series.releasefileglob
107+ ftp://gnu.org/emacs*.gz
108
109 When a driver creates a series, he is also the driver of the new series
110 to make him the release manager.
111
112=== modified file 'lib/lp/registry/interfaces/packaging.py'
113--- lib/lp/registry/interfaces/packaging.py 2009-10-19 16:29:09 +0000
114+++ lib/lp/registry/interfaces/packaging.py 2009-11-19 22:21:17 +0000
115@@ -31,20 +31,20 @@
116 """
117
118 PRIME = DBItem(1, """
119- Primary Product
120+ Primary Project
121
122- This is the primary product packaged in this source package. For
123- example, a source package "apache2" would have a "prime" Packaging
124+ This is the primary project packaged in this source package. For
125+ example, a source package "apache2" would have a "prime" packaging
126 relationship with the "apache2" product from the Apache Project.
127- The product and package don't have to have the same name.
128+ The project and package don't have to have the same name.
129 """)
130
131 INCLUDES = DBItem(2, """
132- SourcePackage Includes Product
133+ SourcePackage Includes Project
134
135- This source package includes some part or all of the product. For
136- example, the "cadaver" source package has an "includes" Packaging
137- relationship with the libneon product.
138+ This source package includes some part or all of the project. For
139+ example, the "cadaver" source package has an "includes" packaging
140+ relationship with the libneon project.
141 """)
142
143
144
145=== modified file 'lib/lp/registry/interfaces/product.py'
146--- lib/lp/registry/interfaces/product.py 2009-11-13 15:22:53 +0000
147+++ lib/lp/registry/interfaces/product.py 2009-11-19 22:21:17 +0000
148@@ -272,8 +272,18 @@
149 class IProductDriverRestricted(Interface):
150 """`IProduct` properties which require launchpad.Driver permission."""
151
152- def newSeries(owner, name, summary, branch=None):
153- """Creates a new ProductSeries for this product."""
154+ def newSeries(owner, name, summary, branch=None, releasefileglob=None):
155+ """Creates a new `IProductSeries` for this `IProduct`.
156+
157+ :param owner: The registrant of this series.
158+ :param name: The unique name of this series.
159+ :param summary: The summary of the purpose and focus of development
160+ of this series.
161+ :param branch: The bazaar branch that contains the code for
162+ this series.
163+ :param releasefileglob: The public URL pattern where release files can
164+ be automatically downloaded from and linked to this series.
165+ """
166
167
168 class IProductEditRestricted(IOfficialBugTagTargetRestricted,):
169@@ -638,7 +648,8 @@
170 :param subscription_months: integer indicating the number of months
171 the voucher is for.
172 :param whiteboard: Notes for this activity.
173- :param current_datetime: Current time. Will be datetime.now() if not specified.
174+ :param current_datetime: Current time. Will be datetime.now() if not
175+ specified.
176 :return: None
177 """
178
179
180=== modified file 'lib/lp/registry/interfaces/sourcepackage.py'
181--- lib/lp/registry/interfaces/sourcepackage.py 2009-11-15 23:23:12 +0000
182+++ lib/lp/registry/interfaces/sourcepackage.py 2009-11-19 22:21:17 +0000
183@@ -94,7 +94,7 @@
184 vocabulary="ProductSeries",
185 schema=Interface,
186 description=_(
187- "The registered project series that this source package."
188+ "The registered project series that this source package. "
189 "is based on. This series may be the same as the one that "
190 "earlier versions of this source packages were based on.")))
191
192
193=== modified file 'lib/lp/registry/model/product.py'
194--- lib/lp/registry/model/product.py 2009-11-13 15:22:53 +0000
195+++ lib/lp/registry/model/product.py 2009-11-19 22:21:17 +0000
196@@ -915,12 +915,14 @@
197 """See `IProduct`."""
198 return ProductSeries.selectOneBy(product=self, name=name)
199
200- def newSeries(self, owner, name, summary, branch=None):
201+ def newSeries(
202+ self, owner, name, summary, branch=None, releasefileglob=None):
203 # XXX: jamesh 2008-04-11
204 # Set the ID of the new ProductSeries to avoid flush order
205 # loops in ProductSet.createProduct()
206- series = ProductSeries(productID=self.id, owner=owner, name=name,
207- summary=summary, branch=branch)
208+ series = ProductSeries(
209+ productID=self.id, owner=owner, name=name,
210+ summary=summary, branch=branch, releasefileglob=releasefileglob)
211 if owner.inTeam(self.driver) and not owner.inTeam(self.owner):
212 # The user is a product driver, and should be the driver of this
213 # series to make him the release manager.