Merge lp://staging/~sinzui/launchpad/not-packaged-0 into lp://staging/launchpad/db-devel

Proposed by Curtis Hovey
Status: Merged
Approved by: Curtis Hovey
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp://staging/~sinzui/launchpad/not-packaged-0
Merge into: lp://staging/launchpad/db-devel
Diff against target: 639 lines (+202/-164)
13 files modified
database/sampledata/current-dev.sql (+38/-38)
database/sampledata/current.sql (+35/-35)
database/schema/comments.sql (+1/-0)
database/schema/patch-2207-52-0.sql (+11/-0)
lib/lp/registry/browser/product.py (+22/-5)
lib/lp/registry/browser/tests/product-portlet-packages-view.txt (+50/-4)
lib/lp/registry/browser/tests/product-views.txt (+0/-78)
lib/lp/registry/configure.zcml (+3/-0)
lib/lp/registry/doc/product.txt (+28/-3)
lib/lp/registry/interfaces/product.py (+10/-0)
lib/lp/registry/model/product.py (+1/-0)
lib/lp/registry/stories/product/xx-product-index.txt (+1/-1)
lib/lp/registry/stories/webservice/xx-project-registry.txt (+2/-0)
To merge this branch: bzr merge lp://staging/~sinzui/launchpad/not-packaged-0
Reviewer Review Type Date Requested Status
Stuart Bishop (community) db Approve
Björn Tillenius (community) db Approve
Brad Crittenden (community) code Approve
Review via email: mp+23693@code.staging.launchpad.net

Description of the change

This is my branch to allow users to say a project is not packaged in Ubuntu.

    lp:~sinzui/launchpad/not-packaged
    Diff size: 632
    Launchpad bug: https://bugs.launchpad.net/bugs/538024
                   https://bugs.launchpad.net/bugs/566659
    Test command: ./bin/test -vv \
        -t reg.*doc/product.txt \
        -t reg.*webservice/xx-project-registry.txt \
        -t reg.*product-views \
        -t reg.*product-portlet-packages-view \
        -t reg.*xx-product-index
    Pre-implementation: Edwin, Jonathan, Brad, Henning, Aaron
    Target release: 10.04

Allow users to say a project is not packaged in Ubuntu
------------------------------------------------------

If you look at https://launchpad.net/launchpad-web you'll see suggestions for
packaging information for the project. Thing is, this project is not packaged
and probably never will be. There's no way of telling Launchpad that or
getting rid of the prompt for packaging on the screen.

Rules
-----

    * Add IProduct.next_suggest_packaging_date to schema and interface.
    * Add a rule to product-portlet-packages to not suggest packages if
      now is less than next_suggest_packaging_date
    * Add an option to the suggested packages:
      This is Not Packaged in Ubuntu
      that sets the date to resume suggestion at 1 year from now.

UI
--

The image at shows the "This project is not packaged in Ubuntu" option
and the fixed button label.

    http://people.canonical.com/~curtis/package-suggestions.png

QA
--

    * Visit https://edge.launchpad.net/gdp (not packaged with suggestions).
    * Choose (This is Not Packaged in Ubuntu).
    * Verify the page does not suggest packages when it reloads.

Lint
----

Linting changed files:
  database/sampledata/current-dev.sql
  database/sampledata/current.sql
  database/schema/comments.sql
  database/schema/patch-2207-96-0.sql
  lib/lp/registry/configure.zcml
  lib/lp/registry/browser/product.py
  lib/lp/registry/browser/tests/product-portlet-packages-view.txt
  lib/lp/registry/browser/tests/product-views.txt
  lib/lp/registry/doc/product.txt
  lib/lp/registry/interfaces/product.py
  lib/lp/registry/model/product.py
  lib/lp/registry/stories/product/xx-product-index.txt
  lib/lp/registry/stories/webservice/xx-project-registry.txt

Test
----

    * lib/lp/registry/doc/product.txt
      * Added documentation for next_suggest_packaging_date.
    * lib/lp/registry/stories/webservice/xx-project-registry.txt
      * Verified that next_suggest_packaging_date is exported.

    * lib/lp/registry/browser/tests/product-views.txt
      * Removed redundant test. product-portlet-packages-view.txt did the
        same tests.
    * lib/lp/registry/browser/tests/product-portlet-packages-view.txt
      * Verified that "This project is not packaged in Ubuntu" is a form
        option.
      * Verified that the form is not rendered when
        next_suggest_packaging_date is greater than now.
      * Verified that choosing "This project is not packaged in Ubuntu" sets
        the next_suggest_packaging_date.
    * lib/lp/registry/stories/product/xx-product-index.txt
      * Updated the test to verify what the user sees.

Implementation
--------------

Regenerated sample data for current and current-dev.

    * database/schema/patch-2207-96-0.sql
      * Added next_suggest_packaging_date column to Product.
    * database/schema/comments.sql
      * Documented Product.next_suggest_packaging_date

    * lib/lp/registry/configure.zcml
      * Any logged in user can set next_suggest_packaging_date, just like
        any logged in user can link a project to a source package.
    * lib/lp/registry/interfaces/product.py
      * Added next_suggest_packaging_date
    * lib/lp/registry/model/product.py
      * Added next_suggest_packaging_date

    * lib/lp/registry/browser/product.py
      * Revised the rules to show the portlet when now is less than
        next_suggest_packaging_date
      * Revised the packages vocabulary to include an option to represent
        that the project is not packaged in Ubuntu.
      * Fixed the casing of the 'Set Ubuntu Package Information' button label.
      * Updated the action to set next_suggest_packaging_date to one year from
        now if the user chooses "This is not packaged in Ubuntu".

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

Hi Curtis,

This change looks very good. Thank you for your persistence in
getting it done.

On IRC I suggested a quiet period equal to the Ubuntu release
schedule, i.e. six months rather than twelve. What was your thinking
for twelve?

> === modified file 'lib/lp/registry/browser/product.py'
> --- lib/lp/registry/browser/product.py 2010-04-14 17:16:56 +0000
> +++ lib/lp/registry/browser/product.py 2010-04-19 18:53:16 +0000
> @@ -44,8 +44,11 @@
>
>
> from cgi import escape
> +from datetime import datetime, timedelta
> from operator import attrgetter
>
> +import pytz
> +
> from zope.component import getUtility
> from zope.event import notify
> from zope.app.form.browser import TextAreaWidget, TextWidget
> @@ -1047,6 +1050,7 @@
> suggestions = None
> max_suggestions = 8
> other_package = object()
> + not_packaged = object()
>
> @cachedproperty
> def sourcepackages(self):
> @@ -1064,8 +1068,10 @@
> return True
> if self.user is None or config.launchpad.is_lpnet:
> return False
> - else:
> - return True
> + next_suggest_packaging_date = self.context.next_suggest_packaging_date
> + return (
> + next_suggest_packaging_date is None
> + or next_suggest_packaging_date < datetime.now(tz=pytz.UTC))

I think <= might be better.

> @property
> def initial_values(self):

review: Approve (code)
Revision history for this message
Björn Tillenius (bjornt) wrote :

This patch looks good now, thanks for all the effort of getting it right!

review: Approve (db)
Revision history for this message
Stuart Bishop (stub) wrote :

Fine. patch-2207-52-0.sql.

Consider date_next_suggest_packaging or similar as the name - we normally use 'date' as a prefix in column names, like date_created, date_modified etc.

review: Approve (db)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to status/vote changes: