Merge lp:~julian-edwards/launchpad/enable-publish-ui-bug-520520 into lp:launchpad

Proposed by Julian Edwards
Status: Merged
Approved by: Julian Edwards
Approved revision: not available
Merged at revision: not available
Proposed branch: lp:~julian-edwards/launchpad/enable-publish-ui-bug-520520
Merge into: lp:launchpad
Diff against target: 100 lines (+19/-8)
4 files modified
lib/lp/soyuz/browser/archive.py (+1/-1)
lib/lp/soyuz/configure.zcml (+1/-1)
lib/lp/soyuz/interfaces/archive.py (+4/-4)
lib/lp/soyuz/stories/ppa/xx-ppa-workflow.txt (+13/-2)
To merge this branch: bzr merge lp:~julian-edwards/launchpad/enable-publish-ui-bug-520520
Reviewer Review Type Date Requested Status
Michael Nelson (community) code Approve
Review via email: mp+20151@code.launchpad.net

Commit message

Enable the archive +edit form to set the 'publish' flag

To post a comment you must log in.
Revision history for this message
Julian Edwards (julian-edwards) wrote :
Download full text (9.1 KiB)

= Summary =
Enable the archive +edit form to set the 'publish' flag

== Proposed fix ==
Simple addition to the form fields on the +edit page.

== Pre-implementation notes ==

== Implementation details ==
It's trivial!

== Tests ==
bin/test -cvvt xx-ppa-workflow.txt

== Demo and Q/A ==

= Launchpad lint =

This lint is all crack. I'm ignoring it. We really need to fix the linter.

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

Linting changed files:
  lib/lp/soyuz/stories/ppa/xx-ppa-workflow.txt
  lib/lp/soyuz/interfaces/archive.py
  lib/lp/soyuz/configure.zcml
  lib/lp/soyuz/browser/archive.py

== Pylint notices ==

lib/lp/soyuz/interfaces/archive.py
    40: [F0401] Unable to import 'lazr.enum' (No module named enum)
    53: [F0401] Unable to import 'lazr.restful.declarations' (No module named
restful)
    59: [F0401] Unable to import 'lazr.restful.fields' (No module named
restful)
    444: [C0322, IArchivePublic.newPackagesetUploader] Operator not preceded
by a space

    packageset=Reference(
    ^
    Interface, title=_("Package set"), required=True),
    explicit=Bool(
    title=_("Explicit"), required=False))

    @export_factory_operation(Interface, [])
    def newPackagesetUploader(person, packageset, explicit=False):
    468: [C0322, IArchivePublic.getUploadersForPackageset] Operator not
preceded by a space
    packageset=Reference(
    ^
    Interface, title=_("Package set"), required=True),
    direct_permissions=Bool(
    title=_("Ignore package set hierarchy"), required=False))

    @operation_returns_collection_of(Interface)
    @export_read_operation()
    def getUploadersForPackageset(packageset, direct_permissions=True):
    490: [C0322, IArchivePublic.deletePackagesetUploader] Operator not
preceded by a space

    packageset=Reference(
    ^
    Interface, title=_("Package set"), required=True),
    explicit=Bool(
    title=_("Explicit"), required=False))
    @export_write_operation()
    def deletePackagesetUploader(person, packageset, explicit=False):
    525: [C0322, IArchivePublic.getPackagesetsForSourceUploader] Operator not
preceded by a space
    person=Reference(schema=IPerson))
    ^

    @operation_returns_collection_of(Interface)
    @export_read_operation()
    def getPackagesetsForSourceUploader(sourcepackagename, person):
    554: [C0322, IArchivePublic.getPackagesetsForSource] Operator not preceded
by a space
    direct_permissions=Bool(
    ^
    title=_("Ignore package set hierarchy"), required=False))

    @operation_returns_collection_of(Interface)
    @export_read_operation()
    def getPackagesetsForSource(
    sourcepackagename, direct_permissions=True):
    583: [C0322, IArchivePublic.isSourceUploadAllowed] Operator not preceded
by a space
    title=_("Source package name"), required=True),
    ^
    person=Reference(schema=IPerson),
    distroseries=Reference(

    Interface,
    title=_("The distro series"), required=False))
    @export_read_operation()
    def isSourceUploadAllowed(sourcepackagename, person, distroseries=None):
    654: [C0322, IArch...

Read more...

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

Great, thanks Julian! (we mentioned just the ordering of the set_attributes).

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/soyuz/browser/archive.py'
2--- lib/lp/soyuz/browser/archive.py 2010-02-11 13:26:21 +0000
3+++ lib/lp/soyuz/browser/archive.py 2010-02-25 17:08:19 +0000
4@@ -1781,7 +1781,7 @@
5
6 class ArchiveEditView(BaseArchiveEditView):
7
8- field_names = ['displayname', 'description', 'enabled']
9+ field_names = ['displayname', 'description', 'enabled', 'publish']
10 custom_widget(
11 'description', TextAreaWidget, height=10, width=30)
12
13
14=== modified file 'lib/lp/soyuz/configure.zcml'
15--- lib/lp/soyuz/configure.zcml 2010-02-09 17:02:18 +0000
16+++ lib/lp/soyuz/configure.zcml 2010-02-25 17:08:19 +0000
17@@ -415,7 +415,7 @@
18 <require
19 permission="launchpad.Edit"
20 interface="lp.soyuz.interfaces.archive.IArchiveEdit"
21- set_attributes="description displayname"/>
22+ set_attributes="description displayname publish"/>
23 <require
24 permission="launchpad.Commercial"
25 set_attributes="authorized_size buildd_secret
26
27=== modified file 'lib/lp/soyuz/interfaces/archive.py'
28--- lib/lp/soyuz/interfaces/archive.py 2010-02-18 17:05:50 +0000
29+++ lib/lp/soyuz/interfaces/archive.py 2010-02-25 17:08:19 +0000
30@@ -145,10 +145,6 @@
31 title=_("Enabled"), required=False,
32 description=_("Whether the archive is enabled or not."))
33
34- publish = Bool(
35- title=_("Publish"), required=False,
36- description=_("Whether the archive is to be published or not."))
37-
38 # This is redefined from IPrivacy.private because the attribute is
39 # read-only. The value is guarded by a validator.
40 private = exported(
41@@ -993,6 +989,10 @@
42 class IArchiveEdit(Interface):
43 """Archive interface for operations restricted by edit privilege."""
44
45+ publish = Bool(
46+ title=_("Publish"), required=False,
47+ description=_("Whether the archive is to be published or not."))
48+
49 @operation_parameters(
50 person=Reference(schema=IPerson),
51 source_package_name=TextLine(
52
53=== modified file 'lib/lp/soyuz/stories/ppa/xx-ppa-workflow.txt'
54--- lib/lp/soyuz/stories/ppa/xx-ppa-workflow.txt 2009-12-14 12:47:54 +0000
55+++ lib/lp/soyuz/stories/ppa/xx-ppa-workflow.txt 2010-02-25 17:08:19 +0000
56@@ -714,27 +714,36 @@
57 == Enabling or disabling of PPAs by the owner ==
58
59 Users with 'launchpad.Edit' permission for a PPA may disable or enable it.
60+They may also change whether the PPA is published to disk or not.
61
62 >>> no_priv_browser = setupBrowser(
63 ... auth='Basic no-priv@canonical.com:test')
64 >>> no_priv_browser.open("http://launchpad.dev/~no-priv/+archive/ppa/+edit")
65
66-Initially, the PPA is enabled.
67+Initially, the PPA is enabled and publishes.
68
69 >>> print no_priv_browser.getControl(name='field.enabled').value
70 True
71+ >>> print no_priv_browser.getControl(name='field.publish').value
72+ True
73
74 After disabling the PPA a warning message is displayed on its page.
75
76 >>> no_priv_browser.getControl(name='field.enabled').value = False
77+ >>> no_priv_browser.getControl(name='field.publish').value = False
78 >>> no_priv_browser.getControl('Save').click()
79 >>> print extract_text(
80 ... first_tag_by_class(no_priv_browser.contents, 'warning message'))
81 This archive has been disabled.
82
83-Once we re-enable the PPA the warning message is gone.
84+Going back to the edit page, we can see the publish flag was cleared:
85
86 >>> no_priv_browser.open("http://launchpad.dev/~no-priv/+archive/ppa/+edit")
87+ >>> print no_priv_browser.getControl(name='field.publish').value
88+ False
89+
90+Once we re-enable the PPA the "disabled" warning message will be gone.
91+
92 >>> print no_priv_browser.getControl(name='field.enabled').value
93 False
94
95@@ -743,3 +752,5 @@
96 >>> (first_tag_by_class(no_priv_browser.contents, 'warning message')
97 ... is None)
98 True
99+
100+