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
=== modified file 'lib/lp/registry/browser/product.py'
--- lib/lp/registry/browser/product.py 2010-01-07 04:59:44 +0000
+++ lib/lp/registry/browser/product.py 2010-01-12 00:34:12 +0000
@@ -1678,13 +1678,16 @@
16781678
1679 def create_product(self, data):1679 def create_product(self, data):
1680 """Create the product from the user data."""1680 """Create the product from the user data."""
1681 project = data.get('project', None)1681 # Get optional data.
1682 project = data.get('project')
1683 description = data.get('description')
1682 return getUtility(IProductSet).createProduct(1684 return getUtility(IProductSet).createProduct(
1683 owner=self.user,1685 owner=self.user,
1684 name=data['name'],1686 name=data['name'],
1687 displayname=data['displayname'],
1685 title=data['title'],1688 title=data['title'],
1686 summary=data['summary'],1689 summary=data['summary'],
1687 displayname=data['displayname'],1690 description=description,
1688 licenses=data['licenses'],1691 licenses=data['licenses'],
1689 license_info=data['license_info'],1692 license_info=data['license_info'],
1690 project=project1693 project=project
16911694
=== modified file 'lib/lp/registry/stories/product/xx-product-add.txt'
--- lib/lp/registry/stories/product/xx-product-add.txt 2009-09-18 15:24:30 +0000
+++ lib/lp/registry/stories/product/xx-product-add.txt 2010-01-12 00:34:12 +0000
@@ -87,7 +87,7 @@
87 >>> user_browser.getControl('Title').value = 'Aardvark Central Command'87 >>> user_browser.getControl('Title').value = 'Aardvark Central Command'
88 >>> user_browser.getControl('Summary').value = (88 >>> user_browser.getControl('Summary').value = (
89 ... 'Control pesky aardvarkian fnords')89 ... 'Control pesky aardvarkian fnords')
90 ... user_browser.getControl('Description').value = (90 >>> user_browser.getControl('Description').value = (
91 ... 'The desktop aardvark is an ornery thing.')91 ... 'The desktop aardvark is an ornery thing.')
9292
93Before a project can be created though, a license for it must be selected.93Before a project can be created though, a license for it must be selected.
@@ -106,6 +106,17 @@
106 >>> print user_browser.title106 >>> print user_browser.title
107 Aardvark Central Command in Launchpad107 Aardvark Central Command in Launchpad
108108
109Let's ensure the summary and description are presented.
110
111 >>> summary = find_tags_by_class(user_browser.contents,
112 ... 'summary', only_first=True)
113 >>> print extract_text(summary)
114 Control pesky aardvarkian fnords
115 >>> desc = find_tags_by_class(user_browser.contents,
116 ... 'description', only_first=True)
117 >>> print extract_text(desc)
118 The desktop aardvark is an ornery thing.
119
109120
110Search results121Search results
111--------------122--------------