Merge lp:~replaceafill/launchpad/bug-125377 into lp:launchpad

Proposed by Douglas Cerna
Status: Merged
Merged at revision: 16911
Proposed branch: lp:~replaceafill/launchpad/bug-125377
Merge into: lp:launchpad
Diff against target: 32 lines (+11/-0)
2 files modified
lib/lp/blueprints/browser/specification.py (+5/-0)
lib/lp/blueprints/browser/tests/test_specification.py (+6/-0)
To merge this branch: bzr merge lp:~replaceafill/launchpad/bug-125377
Reviewer Review Type Date Requested Status
William Grant (community) code Approve
Review via email: mp+200444@code.launchpad.net

Description of the change

Set current user as the default drafter when registering a new blueprint

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) wrote :

Thanks, looks good.

As I mentioned in the other MP, before I can land this you'll need to sign the Canonical Contributor License Agreement. http://www.canonical.com/contributors has details and a link to the online form.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/blueprints/browser/specification.py'
2--- lib/lp/blueprints/browser/specification.py 2013-04-10 08:09:05 +0000
3+++ lib/lp/blueprints/browser/specification.py 2014-01-07 01:41:30 +0000
4@@ -328,6 +328,11 @@
5 'this product')
6 self.setFieldError('information_type', error)
7
8+ def setUpWidgets(self):
9+ super(NewSpecificationView, self).setUpWidgets()
10+ widget = self.widgets['drafter']
11+ widget.setRenderedValue(self.user)
12+
13
14 class NewSpecificationFromTargetView(NewSpecificationView):
15 """An abstract view for creating a specification from a target context.
16
17=== modified file 'lib/lp/blueprints/browser/tests/test_specification.py'
18--- lib/lp/blueprints/browser/tests/test_specification.py 2013-02-07 06:10:38 +0000
19+++ lib/lp/blueprints/browser/tests/test_specification.py 2014-01-07 01:41:30 +0000
20@@ -404,6 +404,12 @@
21 self.assertEqual(
22 InformationType.PUBLIC, view.initial_values['information_type'])
23
24+ def test_default_drafter_is_user(self):
25+ drafter = self.factory.makePerson()
26+ with person_logged_in(drafter):
27+ view = self.createInitializedView()
28+ self.assertEqual(drafter, view.widgets['drafter']._getFormValue())
29+
30
31 class TestNewSpecificationFromRootView(TestCaseWithFactory,
32 NewSpecificationTests):