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
=== modified file 'lib/lp/soyuz/browser/archive.py'
--- lib/lp/soyuz/browser/archive.py 2010-02-11 13:26:21 +0000
+++ lib/lp/soyuz/browser/archive.py 2010-02-25 17:08:19 +0000
@@ -1781,7 +1781,7 @@
17811781
1782class ArchiveEditView(BaseArchiveEditView):1782class ArchiveEditView(BaseArchiveEditView):
17831783
1784 field_names = ['displayname', 'description', 'enabled']1784 field_names = ['displayname', 'description', 'enabled', 'publish']
1785 custom_widget(1785 custom_widget(
1786 'description', TextAreaWidget, height=10, width=30)1786 'description', TextAreaWidget, height=10, width=30)
17871787
17881788
=== modified file 'lib/lp/soyuz/configure.zcml'
--- lib/lp/soyuz/configure.zcml 2010-02-09 17:02:18 +0000
+++ lib/lp/soyuz/configure.zcml 2010-02-25 17:08:19 +0000
@@ -415,7 +415,7 @@
415 <require415 <require
416 permission="launchpad.Edit"416 permission="launchpad.Edit"
417 interface="lp.soyuz.interfaces.archive.IArchiveEdit"417 interface="lp.soyuz.interfaces.archive.IArchiveEdit"
418 set_attributes="description displayname"/>418 set_attributes="description displayname publish"/>
419 <require419 <require
420 permission="launchpad.Commercial"420 permission="launchpad.Commercial"
421 set_attributes="authorized_size buildd_secret421 set_attributes="authorized_size buildd_secret
422422
=== modified file 'lib/lp/soyuz/interfaces/archive.py'
--- lib/lp/soyuz/interfaces/archive.py 2010-02-18 17:05:50 +0000
+++ lib/lp/soyuz/interfaces/archive.py 2010-02-25 17:08:19 +0000
@@ -145,10 +145,6 @@
145 title=_("Enabled"), required=False,145 title=_("Enabled"), required=False,
146 description=_("Whether the archive is enabled or not."))146 description=_("Whether the archive is enabled or not."))
147147
148 publish = Bool(
149 title=_("Publish"), required=False,
150 description=_("Whether the archive is to be published or not."))
151
152 # This is redefined from IPrivacy.private because the attribute is148 # This is redefined from IPrivacy.private because the attribute is
153 # read-only. The value is guarded by a validator.149 # read-only. The value is guarded by a validator.
154 private = exported(150 private = exported(
@@ -993,6 +989,10 @@
993class IArchiveEdit(Interface):989class IArchiveEdit(Interface):
994 """Archive interface for operations restricted by edit privilege."""990 """Archive interface for operations restricted by edit privilege."""
995991
992 publish = Bool(
993 title=_("Publish"), required=False,
994 description=_("Whether the archive is to be published or not."))
995
996 @operation_parameters(996 @operation_parameters(
997 person=Reference(schema=IPerson),997 person=Reference(schema=IPerson),
998 source_package_name=TextLine(998 source_package_name=TextLine(
999999
=== modified file 'lib/lp/soyuz/stories/ppa/xx-ppa-workflow.txt'
--- lib/lp/soyuz/stories/ppa/xx-ppa-workflow.txt 2009-12-14 12:47:54 +0000
+++ lib/lp/soyuz/stories/ppa/xx-ppa-workflow.txt 2010-02-25 17:08:19 +0000
@@ -714,27 +714,36 @@
714== Enabling or disabling of PPAs by the owner ==714== Enabling or disabling of PPAs by the owner ==
715715
716Users with 'launchpad.Edit' permission for a PPA may disable or enable it.716Users with 'launchpad.Edit' permission for a PPA may disable or enable it.
717They may also change whether the PPA is published to disk or not.
717718
718 >>> no_priv_browser = setupBrowser(719 >>> no_priv_browser = setupBrowser(
719 ... auth='Basic no-priv@canonical.com:test')720 ... auth='Basic no-priv@canonical.com:test')
720 >>> no_priv_browser.open("http://launchpad.dev/~no-priv/+archive/ppa/+edit")721 >>> no_priv_browser.open("http://launchpad.dev/~no-priv/+archive/ppa/+edit")
721722
722Initially, the PPA is enabled.723Initially, the PPA is enabled and publishes.
723724
724 >>> print no_priv_browser.getControl(name='field.enabled').value725 >>> print no_priv_browser.getControl(name='field.enabled').value
725 True726 True
727 >>> print no_priv_browser.getControl(name='field.publish').value
728 True
726729
727After disabling the PPA a warning message is displayed on its page.730After disabling the PPA a warning message is displayed on its page.
728731
729 >>> no_priv_browser.getControl(name='field.enabled').value = False732 >>> no_priv_browser.getControl(name='field.enabled').value = False
733 >>> no_priv_browser.getControl(name='field.publish').value = False
730 >>> no_priv_browser.getControl('Save').click()734 >>> no_priv_browser.getControl('Save').click()
731 >>> print extract_text(735 >>> print extract_text(
732 ... first_tag_by_class(no_priv_browser.contents, 'warning message'))736 ... first_tag_by_class(no_priv_browser.contents, 'warning message'))
733 This archive has been disabled.737 This archive has been disabled.
734738
735Once we re-enable the PPA the warning message is gone.739Going back to the edit page, we can see the publish flag was cleared:
736740
737 >>> no_priv_browser.open("http://launchpad.dev/~no-priv/+archive/ppa/+edit")741 >>> no_priv_browser.open("http://launchpad.dev/~no-priv/+archive/ppa/+edit")
742 >>> print no_priv_browser.getControl(name='field.publish').value
743 False
744
745Once we re-enable the PPA the "disabled" warning message will be gone.
746
738 >>> print no_priv_browser.getControl(name='field.enabled').value747 >>> print no_priv_browser.getControl(name='field.enabled').value
739 False748 False
740749
@@ -743,3 +752,5 @@
743 >>> (first_tag_by_class(no_priv_browser.contents, 'warning message')752 >>> (first_tag_by_class(no_priv_browser.contents, 'warning message')
744 ... is None)753 ... is None)
745 True754 True
755
756