launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #02364
[Merge] lp:~gary/launchpad/structuralsubscriptions into lp:launchpad/db-devel
Gary Poster has proposed merging lp:~gary/launchpad/structuralsubscriptions into lp:launchpad/db-devel.
Requested reviews:
Stuart Bishop (stub)
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~gary/launchpad/structuralsubscriptions/+merge/46822
This branch removes the blueprint notification level, which was not used. It is removed for cleanliness, because we do not intend to implement it at this time, and we are moving to a non-enumeration approach for bugs notifications. If we want to implement this for blueprints, we will add it this new way, then.
--
https://code.launchpad.net/~gary/launchpad/structuralsubscriptions/+merge/46822
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~gary/launchpad/structuralsubscriptions into lp:launchpad/db-devel.
=== modified file 'database/sampledata/current-dev.sql'
--- database/sampledata/current-dev.sql 2010-12-21 00:32:34 +0000
+++ database/sampledata/current-dev.sql 2011-01-19 20:34:23 +0000
@@ -3694,10 +3694,10 @@
ALTER TABLE structuralsubscription DISABLE TRIGGER ALL;
-INSERT INTO structuralsubscription (id, product, productseries, project, milestone, distribution, distroseries, sourcepackagename, subscriber, subscribed_by, bug_notification_level, blueprint_notification_level, date_created, date_last_updated) VALUES (1, NULL, NULL, NULL, NULL, 1, NULL, 1, 16, 16, 40, 10, '2008-01-29 15:12:34.581468', '2008-01-29 15:12:34.581468');
-INSERT INTO structuralsubscription (id, product, productseries, project, milestone, distribution, distroseries, sourcepackagename, subscriber, subscribed_by, bug_notification_level, blueprint_notification_level, date_created, date_last_updated) VALUES (2, NULL, NULL, NULL, NULL, 1, NULL, 14, 16, 16, 40, 10, '2008-01-29 15:12:34.581468', '2008-01-29 15:12:34.581468');
-INSERT INTO structuralsubscription (id, product, productseries, project, milestone, distribution, distroseries, sourcepackagename, subscriber, subscribed_by, bug_notification_level, blueprint_notification_level, date_created, date_last_updated) VALUES (3, 22, NULL, NULL, NULL, NULL, NULL, NULL, 64, 64, 40, 10, '2008-02-06 12:17:13.030376', '2008-02-06 12:17:13.030376');
-INSERT INTO structuralsubscription (id, product, productseries, project, milestone, distribution, distroseries, sourcepackagename, subscriber, subscribed_by, bug_notification_level, blueprint_notification_level, date_created, date_last_updated) VALUES (4, 16, NULL, NULL, NULL, NULL, NULL, NULL, 64, 64, 40, 10, '2008-02-06 12:17:13.030376', '2008-02-06 12:17:13.030376');
+INSERT INTO structuralsubscription (id, product, productseries, project, milestone, distribution, distroseries, sourcepackagename, subscriber, subscribed_by, bug_notification_level, date_created, date_last_updated) VALUES (1, NULL, NULL, NULL, NULL, 1, NULL, 1, 16, 16, 40, '2008-01-29 15:12:34.581468', '2008-01-29 15:12:34.581468');
+INSERT INTO structuralsubscription (id, product, productseries, project, milestone, distribution, distroseries, sourcepackagename, subscriber, subscribed_by, bug_notification_level, date_created, date_last_updated) VALUES (2, NULL, NULL, NULL, NULL, 1, NULL, 14, 16, 16, 40, '2008-01-29 15:12:34.581468', '2008-01-29 15:12:34.581468');
+INSERT INTO structuralsubscription (id, product, productseries, project, milestone, distribution, distroseries, sourcepackagename, subscriber, subscribed_by, bug_notification_level, date_created, date_last_updated) VALUES (3, 22, NULL, NULL, NULL, NULL, NULL, NULL, 64, 64, 40, '2008-02-06 12:17:13.030376', '2008-02-06 12:17:13.030376');
+INSERT INTO structuralsubscription (id, product, productseries, project, milestone, distribution, distroseries, sourcepackagename, subscriber, subscribed_by, bug_notification_level, date_created, date_last_updated) VALUES (4, 16, NULL, NULL, NULL, NULL, NULL, NULL, 64, 64, 40, '2008-02-06 12:17:13.030376', '2008-02-06 12:17:13.030376');
ALTER TABLE structuralsubscription ENABLE TRIGGER ALL;
@@ -5990,8 +5990,8 @@
ALTER TABLE nameblacklist DISABLE TRIGGER ALL;
-INSERT INTO nameblacklist (id, regexp, comment) VALUES (1, 'blacklist', 'For testing purposes');
-INSERT INTO nameblacklist (id, regexp, comment) VALUES (2, '^admin', NULL);
+INSERT INTO nameblacklist (id, regexp, comment, admin) VALUES (1, 'blacklist', 'For testing purposes', NULL);
+INSERT INTO nameblacklist (id, regexp, comment, admin) VALUES (2, '^admin', NULL, NULL);
ALTER TABLE nameblacklist ENABLE TRIGGER ALL;
=== modified file 'database/sampledata/current.sql'
--- database/sampledata/current.sql 2010-12-21 00:32:34 +0000
+++ database/sampledata/current.sql 2011-01-19 20:34:23 +0000
@@ -3694,10 +3694,10 @@
ALTER TABLE structuralsubscription DISABLE TRIGGER ALL;
-INSERT INTO structuralsubscription (id, product, productseries, project, milestone, distribution, distroseries, sourcepackagename, subscriber, subscribed_by, bug_notification_level, blueprint_notification_level, date_created, date_last_updated) VALUES (1, NULL, NULL, NULL, NULL, 1, NULL, 1, 16, 16, 40, 10, '2008-01-29 15:12:34.581468', '2008-01-29 15:12:34.581468');
-INSERT INTO structuralsubscription (id, product, productseries, project, milestone, distribution, distroseries, sourcepackagename, subscriber, subscribed_by, bug_notification_level, blueprint_notification_level, date_created, date_last_updated) VALUES (2, NULL, NULL, NULL, NULL, 1, NULL, 14, 16, 16, 40, 10, '2008-01-29 15:12:34.581468', '2008-01-29 15:12:34.581468');
-INSERT INTO structuralsubscription (id, product, productseries, project, milestone, distribution, distroseries, sourcepackagename, subscriber, subscribed_by, bug_notification_level, blueprint_notification_level, date_created, date_last_updated) VALUES (3, 22, NULL, NULL, NULL, NULL, NULL, NULL, 64, 64, 40, 10, '2008-02-06 12:17:13.030376', '2008-02-06 12:17:13.030376');
-INSERT INTO structuralsubscription (id, product, productseries, project, milestone, distribution, distroseries, sourcepackagename, subscriber, subscribed_by, bug_notification_level, blueprint_notification_level, date_created, date_last_updated) VALUES (4, 16, NULL, NULL, NULL, NULL, NULL, NULL, 64, 64, 40, 10, '2008-02-06 12:17:13.030376', '2008-02-06 12:17:13.030376');
+INSERT INTO structuralsubscription (id, product, productseries, project, milestone, distribution, distroseries, sourcepackagename, subscriber, subscribed_by, bug_notification_level, date_created, date_last_updated) VALUES (1, NULL, NULL, NULL, NULL, 1, NULL, 1, 16, 16, 40, '2008-01-29 15:12:34.581468', '2008-01-29 15:12:34.581468');
+INSERT INTO structuralsubscription (id, product, productseries, project, milestone, distribution, distroseries, sourcepackagename, subscriber, subscribed_by, bug_notification_level, date_created, date_last_updated) VALUES (2, NULL, NULL, NULL, NULL, 1, NULL, 14, 16, 16, 40, '2008-01-29 15:12:34.581468', '2008-01-29 15:12:34.581468');
+INSERT INTO structuralsubscription (id, product, productseries, project, milestone, distribution, distroseries, sourcepackagename, subscriber, subscribed_by, bug_notification_level, date_created, date_last_updated) VALUES (3, 22, NULL, NULL, NULL, NULL, NULL, NULL, 64, 64, 40, '2008-02-06 12:17:13.030376', '2008-02-06 12:17:13.030376');
+INSERT INTO structuralsubscription (id, product, productseries, project, milestone, distribution, distroseries, sourcepackagename, subscriber, subscribed_by, bug_notification_level, date_created, date_last_updated) VALUES (4, 16, NULL, NULL, NULL, NULL, NULL, NULL, 64, 64, 40, '2008-02-06 12:17:13.030376', '2008-02-06 12:17:13.030376');
ALTER TABLE structuralsubscription ENABLE TRIGGER ALL;
@@ -5995,8 +5995,8 @@
ALTER TABLE nameblacklist DISABLE TRIGGER ALL;
-INSERT INTO nameblacklist (id, regexp, comment) VALUES (1, 'blacklist', 'For testing purposes');
-INSERT INTO nameblacklist (id, regexp, comment) VALUES (2, '^admin', NULL);
+INSERT INTO nameblacklist (id, regexp, comment, admin) VALUES (1, 'blacklist', 'For testing purposes', NULL);
+INSERT INTO nameblacklist (id, regexp, comment, admin) VALUES (2, '^admin', NULL, NULL);
ALTER TABLE nameblacklist ENABLE TRIGGER ALL;
=== modified file 'database/schema/comments.sql'
--- database/schema/comments.sql 2011-01-05 23:58:29 +0000
+++ database/schema/comments.sql 2011-01-19 20:34:23 +0000
@@ -2395,7 +2395,6 @@
COMMENT ON COLUMN StructuralSubscription.subscriber IS 'The person subscribed.';
COMMENT ON COLUMN StructuralSubscription.subscribed_by IS 'The person initiating the subscription.';
COMMENT ON COLUMN StructuralSubscription.bug_notification_level IS 'The volume and type of bug notifications this subscription will generate. The value is an item of the enumeration `BugNotificationLevel`.';
-COMMENT ON COLUMN StructuralSubscription.blueprint_notification_level IS 'The volume and type of blueprint notifications this subscription will generate. The value is an item of the enumeration `BugNotificationLevel`.';
COMMENT ON COLUMN StructuralSubscription.date_created IS 'The date on which this subscription was created.';
COMMENT ON COLUMN StructuralSubscription.date_last_updated IS 'The date on which this subscription was last updated.';
=== added file 'database/schema/patch-2208-99-0.sql'
--- database/schema/patch-2208-99-0.sql 1970-01-01 00:00:00 +0000
+++ database/schema/patch-2208-99-0.sql 2011-01-19 20:34:23 +0000
@@ -0,0 +1,8 @@
+-- Copyright 2011 Canonical Ltd. This software is licensed under the
+-- GNU Affero General Public License version 3 (see the file LICENSE).
+SET client_min_messages=ERROR;
+
+ALTER TABLE StructuralSubscription
+ DROP COLUMN blueprint_notification_level;
+
+INSERT INTO LaunchpadDatabaseRevision VALUES (2208, 99, 0);
=== modified file 'lib/lp/registry/doc/structural-subscriptions.txt'
--- lib/lp/registry/doc/structural-subscriptions.txt 2010-10-26 12:53:04 +0000
+++ lib/lp/registry/doc/structural-subscriptions.txt 2011-01-19 20:34:23 +0000
@@ -31,8 +31,6 @@
... subscriber=sampleperson, subscribed_by=foobar)
>>> ubuntu_sub.target
<Distribution 'Ubuntu' (ubuntu)>
- >>> ubuntu_sub.blueprint_notification_level
- <DBItem BlueprintNotificationLevel.NOTHING, (10) Nothing>
>>> evolution = getUtility(ISourcePackageNameSet).getOrCreateByName(
... 'evolution')
=== modified file 'lib/lp/registry/interfaces/structuralsubscription.py'
--- lib/lp/registry/interfaces/structuralsubscription.py 2011-01-13 15:12:36 +0000
+++ lib/lp/registry/interfaces/structuralsubscription.py 2011-01-19 20:34:23 +0000
@@ -8,7 +8,6 @@
__metaclass__ = type
__all__ = [
- 'BlueprintNotificationLevel',
'BugNotificationLevel',
'IStructuralSubscription',
'IStructuralSubscriptionForm',
@@ -56,33 +55,6 @@
)
-class BlueprintNotificationLevel(DBEnumeratedType):
- """Bug Notification Level.
-
- The type and volume of blueprint notification email sent to subscribers.
- """
-
- NOTHING = DBItem(10, """
- Nothing
-
- Don't send any notifications about blueprints.
- """)
-
- LIFECYCLE = DBItem(20, """
- Lifecycle
-
- Only send a low volume of notifications about new blueprints
- registered, blueprints accepted or blueprint targetting.
- """)
-
- METADATA = DBItem(30, """
- Details
-
- Send blueprint lifecycle notifications, as well as notifications about
- changes to the blueprints's details like status and description.
- """)
-
-
class IStructuralSubscriptionPublic(Interface):
"""The public parts of a subscription to a Launchpad structure."""
@@ -110,12 +82,6 @@
default=BugNotificationLevel.NOTHING,
description=_("The volume and type of bug notifications "
"this subscription will generate."))
- blueprint_notification_level = Choice(
- title=_("Blueprint notification level"), required=True,
- vocabulary=BlueprintNotificationLevel,
- default=BlueprintNotificationLevel.NOTHING,
- description=_("The volume and type of blueprint notifications "
- "this subscription will generate."))
date_created = exported(Datetime(
title=_("The date on which this subscription was created."),
required=False, readonly=True))
@@ -158,19 +124,14 @@
# We don't really want to expose the level details yet. Only
# BugNotificationLevel.COMMENTS is used at this time.
@call_with(
- min_bug_notification_level=BugNotificationLevel.COMMENTS,
- min_blueprint_notification_level=BlueprintNotificationLevel.NOTHING)
+ min_bug_notification_level=BugNotificationLevel.COMMENTS)
@operation_returns_collection_of(IStructuralSubscription)
@export_read_operation()
- def getSubscriptions(min_bug_notification_level,
- min_blueprint_notification_level):
+ def getSubscriptions(min_bug_notification_level):
"""Return all the subscriptions with the specified levels.
:min_bug_notification_level: The lowest bug notification level
for which subscriptions should be returned.
- :min_blueprint_notification_level: The lowest bleuprint
- notification level for which subscriptions should
- be returned.
:return: A sequence of `IStructuralSubscription`.
"""
=== modified file 'lib/lp/registry/model/structuralsubscription.py'
--- lib/lp/registry/model/structuralsubscription.py 2010-12-21 09:31:38 +0000
+++ lib/lp/registry/model/structuralsubscription.py 2011-01-19 20:34:23 +0000
@@ -66,7 +66,6 @@
from lp.registry.interfaces.productseries import IProductSeries
from lp.registry.interfaces.projectgroup import IProjectGroup
from lp.registry.interfaces.structuralsubscription import (
- BlueprintNotificationLevel,
IStructuralSubscription,
IStructuralSubscriptionTarget,
IStructuralSubscriptionTargetHelper,
@@ -111,10 +110,6 @@
enum=BugNotificationLevel,
default=BugNotificationLevel.NOTHING,
notNull=True)
- blueprint_notification_level = EnumCol(
- enum=BlueprintNotificationLevel,
- default=BlueprintNotificationLevel.NOTHING,
- notNull=True)
date_created = UtcDateTimeCol(
dbName='date_created', notNull=True, default=UTC_NOW)
date_last_updated = UtcDateTimeCol(
@@ -424,15 +419,7 @@
raise DeleteSubscriptionError(
"%s is not subscribed to %s." % (
subscriber.name, self.displayname))
- else:
- if (subscription_to_remove.blueprint_notification_level >
- BlueprintNotificationLevel.NOTHING):
- # This is a subscription to other application too
- # so only set the bug notification level
- subscription_to_remove.bug_notification_level = (
- BugNotificationLevel.NOTHING)
- else:
- subscription_to_remove.destroySelf()
+ subscription_to_remove.destroySelf()
def getSubscription(self, person):
"""See `IStructuralSubscriptionTarget`."""
@@ -444,16 +431,12 @@
def getSubscriptions(self,
min_bug_notification_level=
- BugNotificationLevel.NOTHING,
- min_blueprint_notification_level=
- BlueprintNotificationLevel.NOTHING):
+ BugNotificationLevel.NOTHING):
"""See `IStructuralSubscriptionTarget`."""
clauses = [
"StructuralSubscription.subscriber = Person.id",
"StructuralSubscription.bug_notification_level "
">= %s" % quote(min_bug_notification_level),
- "StructuralSubscription.blueprint_notification_level "
- ">= %s" % quote(min_blueprint_notification_level),
]
for key, value in self._target_args.iteritems():
if value is None:
=== modified file 'lib/lp/registry/tests/structural-subscription-target.txt'
--- lib/lp/registry/tests/structural-subscription-target.txt 2010-10-17 15:44:08 +0000
+++ lib/lp/registry/tests/structural-subscription-target.txt 2011-01-19 20:34:23 +0000
@@ -19,23 +19,17 @@
>>> def print_subscriptions_list(subscriptions):
... for subscription in subscriptions:
- ... print '%s %s %s' % (
+ ... print '%s %s' % (
... subscription.subscriber.name,
- ... subscription.bug_notification_level.name,
- ... subscription.blueprint_notification_level.name)
-
- >>> from lp.registry.interfaces.structuralsubscription import BlueprintNotificationLevel
+ ... subscription.bug_notification_level.name)
>>> subscription = target.addBugSubscription(foobar, foobar)
- >>> subscription.blueprint_notification_level = (
- ... BlueprintNotificationLevel.LIFECYCLE)
>>> print_subscriptions_list(target.getSubscriptions())
- name16 COMMENTS LIFECYCLE
- ubuntu-team COMMENTS NOTHING
+ name16 COMMENTS
+ ubuntu-team COMMENTS
>>> target.removeBugSubscription(foobar, foobar)
>>> print_subscriptions_list(target.getSubscriptions())
- name16 NOTHING LIFECYCLE
- ubuntu-team COMMENTS NOTHING
+ ubuntu-team COMMENTS
To get a user's subscription to the target, use
IStructuralSubscriptionTarget.getSubscription.
@@ -52,12 +46,12 @@
>>> subscription = target.addSubscription(no_priv, no_priv)
>>> subscription.bug_notification_level = BugNotificationLevel.METADATA
>>> print_subscriptions_list(target.bug_subscriptions)
- no-priv METADATA NOTHING
- ubuntu-team COMMENTS NOTHING
+ no-priv METADATA
+ ubuntu-team COMMENTS
>>> subscriptions = target.getSubscriptions(min_bug_notification_level=
... BugNotificationLevel.COMMENTS)
>>> print_subscriptions_list(subscriptions)
- ubuntu-team COMMENTS NOTHING
+ ubuntu-team COMMENTS
Structural subscriptions and indirect bug subscriptions
Follow ups