Merge lp:~bac/launchpad/bug-407604-proj-desc into lp:launchpad

Proposed by Brad Crittenden
Status: Merged
Merged at revision: not available
Proposed branch: lp:~bac/launchpad/bug-407604-proj-desc
Merge into: lp:launchpad
Diff against target: 53 lines (+17/-3)
2 files modified
lib/lp/registry/browser/product.py (+5/-2)
lib/lp/registry/stories/product/xx-product-add.txt (+12/-1)
To merge this branch: bzr merge lp:~bac/launchpad/bug-407604-proj-desc
Reviewer Review Type Date Requested Status
Guilherme Salgado (community) code Approve
Review via email: mp+17028@code.launchpad.net

Commit message

Fix a bug where the product description is not set when creating a new product.

To post a comment you must log in.
Revision history for this message
Brad Crittenden (bac) wrote :

= Summary =

During project registration the user enters a project description but we then fail to
use it, requiring the data to be entered again on another page. Very annoying for
our users.

== Proposed fix ==

Use the data!

== Pre-implementation notes ==

None

== Implementation details ==

As above.

Note the original test had the setting of the description wrong in that it started
with '...' not '>>>' which silently fails. Argh. Took me an hour to find that.
Wouldn't have mattered, though, as it wasn't being checked.

== Tests ==

bin/test -vvt xx-product-add.txt

== Demo and Q/A ==

Create a project. Add a description. See that it appears on the overview page.

= Launchpad lint =

Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.

Linting changed files:
  lib/lp/registry/browser/product.py
  lib/lp/registry/stories/product/xx-product-add.txt

== Pylint notices ==

lib/lp/registry/browser/product.py
    54: [F0401] Unable to import 'lazr.delegates' (No module named delegates)

Revision history for this message
Guilherme Salgado (salgado) wrote :

Hi Brad,

9 project = data.get('project', None)
10 + description = data.get('description', None)

I'd just use "data.get('foo')" above as None is the default of dict.get() anyway.

review: Approve (code)
Revision history for this message
Brad Crittenden (bac) wrote :

Thanks for the review Salgado. Your change was made.

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 2010-01-07 04:59:44 +0000
3+++ lib/lp/registry/browser/product.py 2010-01-12 00:34:12 +0000
4@@ -1678,13 +1678,16 @@
5
6 def create_product(self, data):
7 """Create the product from the user data."""
8- project = data.get('project', None)
9+ # Get optional data.
10+ project = data.get('project')
11+ description = data.get('description')
12 return getUtility(IProductSet).createProduct(
13 owner=self.user,
14 name=data['name'],
15+ displayname=data['displayname'],
16 title=data['title'],
17 summary=data['summary'],
18- displayname=data['displayname'],
19+ description=description,
20 licenses=data['licenses'],
21 license_info=data['license_info'],
22 project=project
23
24=== modified file 'lib/lp/registry/stories/product/xx-product-add.txt'
25--- lib/lp/registry/stories/product/xx-product-add.txt 2009-09-18 15:24:30 +0000
26+++ lib/lp/registry/stories/product/xx-product-add.txt 2010-01-12 00:34:12 +0000
27@@ -87,7 +87,7 @@
28 >>> user_browser.getControl('Title').value = 'Aardvark Central Command'
29 >>> user_browser.getControl('Summary').value = (
30 ... 'Control pesky aardvarkian fnords')
31- ... user_browser.getControl('Description').value = (
32+ >>> user_browser.getControl('Description').value = (
33 ... 'The desktop aardvark is an ornery thing.')
34
35 Before a project can be created though, a license for it must be selected.
36@@ -106,6 +106,17 @@
37 >>> print user_browser.title
38 Aardvark Central Command in Launchpad
39
40+Let's ensure the summary and description are presented.
41+
42+ >>> summary = find_tags_by_class(user_browser.contents,
43+ ... 'summary', only_first=True)
44+ >>> print extract_text(summary)
45+ Control pesky aardvarkian fnords
46+ >>> desc = find_tags_by_class(user_browser.contents,
47+ ... 'description', only_first=True)
48+ >>> print extract_text(desc)
49+ The desktop aardvark is an ornery thing.
50+
51
52 Search results
53 --------------