launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #02464
[Merge] lp:~gary/launchpad/move-bugnotificationlevel-enum into lp:launchpad/db-devel
Gary Poster has proposed merging lp:~gary/launchpad/move-bugnotificationlevel-enum into lp:launchpad/db-devel with lp:~gary/launchpad/move-events-to-filters as a prerequisite.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~gary/launchpad/move-bugnotificationlevel-enum/+merge/48178
This branch moves the bugnotificationlevel enum from registry to bugs. This is a cleanup, because the bugnotificationlevel has everything to do with bugs, and very little to do with registry.
This branch is intended to be mechanical: simply moving the enum and fixing imports.
Thank you
--
https://code.launchpad.net/~gary/launchpad/move-bugnotificationlevel-enum/+merge/48178
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~gary/launchpad/move-bugnotificationlevel-enum into lp:launchpad/db-devel.
=== modified file 'lib/canonical/launchpad/mail/helpers.py'
--- lib/canonical/launchpad/mail/helpers.py 2011-02-01 15:29:38 +0000
+++ lib/canonical/launchpad/mail/helpers.py 2011-02-01 15:29:39 +0000
@@ -21,7 +21,7 @@
from canonical.launchpad.webapp import canonical_url
from canonical.launchpad.webapp.interaction import get_current_principal
from canonical.launchpad.webapp.interfaces import ILaunchBag
-from lp.registry.enum import BugNotificationLevel
+from lp.bugs.enum import BugNotificationLevel
from lp.registry.vocabularies import ValidPersonOrTeamVocabulary
=== modified file 'lib/lp/bugs/browser/bugsubscription.py'
--- lib/lp/bugs/browser/bugsubscription.py 2011-01-21 20:23:43 +0000
+++ lib/lp/bugs/browser/bugsubscription.py 2011-02-01 15:29:39 +0000
@@ -37,8 +37,8 @@
LaunchpadFormView,
)
from lp.bugs.browser.bug import BugViewMixin
+from lp.bugs.enum import BugNotificationLevel
from lp.bugs.interfaces.bugsubscription import IBugSubscription
-from lp.registry.enum import BugNotificationLevel
from lp.services import features
from lp.services.propertycache import cachedproperty
=== modified file 'lib/lp/bugs/browser/bugsubscriptionfilter.py'
--- lib/lp/bugs/browser/bugsubscriptionfilter.py 2011-02-01 15:29:38 +0000
+++ lib/lp/bugs/browser/bugsubscriptionfilter.py 2011-02-01 15:29:39 +0000
@@ -22,10 +22,10 @@
custom_widget,
LaunchpadEditFormView,
)
-from lp.registry.enum import BugNotificationLevel
from lp.services.propertycache import cachedproperty
from lp.bugs.browser.widgets.bug import BugTagsFrozenSetWidget
from lp.bugs.browser.bugsubscription import AdvancedSubscriptionMixin
+from lp.bugs.enum import BugNotificationLevel
from lp.bugs.interfaces.bugsubscriptionfilter import IBugSubscriptionFilter
=== modified file 'lib/lp/bugs/browser/tests/test_bugsubscription_views.py'
--- lib/lp/bugs/browser/tests/test_bugsubscription_views.py 2010-11-12 11:02:58 +0000
+++ lib/lp/bugs/browser/tests/test_bugsubscription_views.py 2011-02-01 15:29:39 +0000
@@ -13,7 +13,7 @@
BugSubscriptionAddView,
BugSubscriptionSubscribeSelfView,
)
-from lp.registry.enum import BugNotificationLevel
+from lp.bugs.enum import BugNotificationLevel
from lp.testing import (
feature_flags,
person_logged_in,
=== modified file 'lib/lp/bugs/browser/tests/test_bugsubscriptionfilter.py'
--- lib/lp/bugs/browser/tests/test_bugsubscriptionfilter.py 2011-02-01 15:29:38 +0000
+++ lib/lp/bugs/browser/tests/test_bugsubscriptionfilter.py 2011-02-01 15:29:39 +0000
@@ -21,14 +21,14 @@
DatabaseFunctionalLayer,
LaunchpadFunctionalLayer,
)
+from lp.bugs.browser.structuralsubscription import (
+ StructuralSubscriptionNavigation,
+ )
+from lp.bugs.enum import BugNotificationLevel
from lp.bugs.interfaces.bugtask import (
BugTaskImportance,
BugTaskStatus,
)
-from lp.bugs.browser.structuralsubscription import (
- StructuralSubscriptionNavigation,
- )
-from lp.registry.enum import BugNotificationLevel
from lp.testing import (
feature_flags,
set_feature_flag,
=== modified file 'lib/lp/bugs/doc/bug-change.txt'
--- lib/lp/bugs/doc/bug-change.txt 2011-02-01 15:29:38 +0000
+++ lib/lp/bugs/doc/bug-change.txt 2011-02-01 15:29:39 +0000
@@ -141,7 +141,7 @@
>>> from lp.testing import person_logged_in
- >>> from lp.registry.enum import BugNotificationLevel
+ >>> from lp.bugs.enum import BugNotificationLevel
>>> lifecycle_subscriber = factory.makePerson(
... displayname='Lifecycle subscriber')
>>> metadata_subscriber = factory.makePerson(
=== modified file 'lib/lp/bugs/doc/bugnotification-sending.txt'
--- lib/lp/bugs/doc/bugnotification-sending.txt 2011-02-01 15:29:38 +0000
+++ lib/lp/bugs/doc/bugnotification-sending.txt 2011-02-01 15:29:39 +0000
@@ -1108,7 +1108,7 @@
>>> flush_notifications()
>>> switch_db_to_launchpad()
- >>> from lp.registry.enum import BugNotificationLevel
+ >>> from lp.bugs.enum import BugNotificationLevel
>>> from lp.registry.interfaces.product import IProductSet
>>> firefox = getUtility(IProductSet).getByName('firefox')
>>> mr_no_privs = getUtility(IPersonSet).getByName('no-priv')
=== modified file 'lib/lp/bugs/doc/bugsubscription.txt'
--- lib/lp/bugs/doc/bugsubscription.txt 2011-02-01 15:29:38 +0000
+++ lib/lp/bugs/doc/bugsubscription.txt 2011-02-01 15:29:39 +0000
@@ -262,7 +262,7 @@
With this subscription level, No Privileges Person is returned for all
parameter values of level.
- >>> from lp.registry.enum import BugNotificationLevel
+ >>> from lp.bugs.enum import BugNotificationLevel
>>> print_displayname(linux_source_bug.getAlsoNotifiedSubscribers(
... level=BugNotificationLevel.COMMENTS))
No Privileges Person
=== added file 'lib/lp/bugs/enum.py'
--- lib/lp/bugs/enum.py 1970-01-01 00:00:00 +0000
+++ lib/lp/bugs/enum.py 2011-02-01 15:29:39 +0000
@@ -0,0 +1,49 @@
+# Copyright 2010 Canonical Ltd. This software is licensed under the
+# GNU Affero General Public License version 3 (see the file LICENSE).
+
+"""Enums for the Bugs app."""
+
+__metaclass__ = type
+__all__ = [
+ 'BugNotificationLevel',
+ ]
+
+from lazr.enum import (
+ DBEnumeratedType,
+ DBItem,
+ )
+
+
+class BugNotificationLevel(DBEnumeratedType):
+ """Bug Notification Level.
+
+ The type and volume of bug notification email sent to subscribers.
+ """
+
+ NOTHING = DBItem(10, """
+ Nothing
+
+ Don't send any notifications about bugs.
+ """)
+
+ LIFECYCLE = DBItem(20, """
+ Lifecycle
+
+ Only send a low volume of notifications about new bugs registered,
+ bugs removed or bug targetting.
+ """)
+
+ METADATA = DBItem(30, """
+ Details
+
+ Send bug lifecycle notifications, as well as notifications about
+ changes to the bug's details like status and description.
+ """)
+
+ COMMENTS = DBItem(40, """
+ Discussion
+
+ Send bug lifecycle notifications, detail change notifications and
+ notifications about new events in the bugs's discussion, like new
+ comments.
+ """)
=== modified file 'lib/lp/bugs/interfaces/bugsubscription.py'
--- lib/lp/bugs/interfaces/bugsubscription.py 2011-01-27 16:43:57 +0000
+++ lib/lp/bugs/interfaces/bugsubscription.py 2011-02-01 15:29:39 +0000
@@ -30,8 +30,8 @@
)
from canonical.launchpad import _
+from lp.bugs.enum import BugNotificationLevel
from lp.bugs.interfaces.bug import IBug
-from lp.registry.enum import BugNotificationLevel
from lp.services.fields import PersonChoice
=== modified file 'lib/lp/bugs/interfaces/bugsubscriptionfilter.py'
--- lib/lp/bugs/interfaces/bugsubscriptionfilter.py 2011-02-01 15:29:38 +0000
+++ lib/lp/bugs/interfaces/bugsubscriptionfilter.py 2011-02-01 15:29:39 +0000
@@ -25,7 +25,7 @@
)
from canonical.launchpad import _
-from lp.registry.enum import BugNotificationLevel
+from lp.bugs.enum import BugNotificationLevel
from lp.bugs.interfaces.bugtask import (
BugTaskImportance,
BugTaskStatus,
=== modified file 'lib/lp/bugs/model/bug.py'
--- lib/lp/bugs/model/bug.py 2011-01-24 20:53:10 +0000
+++ lib/lp/bugs/model/bug.py 2011-02-01 15:29:39 +0000
@@ -121,6 +121,7 @@
SeriesNominated,
UnsubscribedFromBug,
)
+from lp.bugs.enum import BugNotificationLevel
from lp.bugs.errors import InvalidDuplicateValue
from lp.bugs.interfaces.bug import (
IBug,
@@ -167,7 +168,6 @@
)
from lp.bugs.model.bugwatch import BugWatch
from lp.hardwaredb.interfaces.hwdb import IHWSubmissionBugSet
-from lp.registry.enum import BugNotificationLevel
from lp.registry.interfaces.distribution import IDistribution
from lp.registry.interfaces.distributionsourcepackage import (
IDistributionSourcePackage,
=== modified file 'lib/lp/bugs/model/bugsubscription.py'
--- lib/lp/bugs/model/bugsubscription.py 2011-01-27 09:47:06 +0000
+++ lib/lp/bugs/model/bugsubscription.py 2011-02-01 15:29:39 +0000
@@ -16,8 +16,8 @@
from canonical.database.constants import UTC_NOW
from canonical.database.enumcol import DBEnum
+from lp.bugs.enum import BugNotificationLevel
from lp.bugs.interfaces.bugsubscription import IBugSubscription
-from lp.registry.enum import BugNotificationLevel
from lp.registry.interfaces.person import validate_person
from lp.services.database.stormbase import StormBase
=== modified file 'lib/lp/bugs/model/bugsubscriptionfilter.py'
--- lib/lp/bugs/model/bugsubscriptionfilter.py 2011-02-01 15:29:38 +0000
+++ lib/lp/bugs/model/bugsubscriptionfilter.py 2011-02-01 15:29:39 +0000
@@ -20,8 +20,8 @@
from canonical.database.enumcol import DBEnum
from canonical.launchpad import searchbuilder
from canonical.launchpad.interfaces.lpstorm import IStore
+from lp.bugs.enum import BugNotificationLevel
from lp.bugs.interfaces.bugsubscriptionfilter import IBugSubscriptionFilter
-from lp.registry.enum import BugNotificationLevel
from lp.bugs.model.bugsubscriptionfilterimportance import (
BugSubscriptionFilterImportance,
)
=== modified file 'lib/lp/bugs/model/bugtask.py'
--- lib/lp/bugs/model/bugtask.py 2011-01-21 08:30:55 +0000
+++ lib/lp/bugs/model/bugtask.py 2011-02-01 15:29:39 +0000
@@ -97,6 +97,7 @@
)
from lp.app.enums import ServiceUsage
from lp.app.errors import NotFoundError
+from lp.bugs.enum import BugNotificationLevel
from lp.bugs.interfaces.bug import IBugSet
from lp.bugs.interfaces.bugattachment import BugAttachmentType
from lp.bugs.interfaces.bugnomination import BugNominationStatus
@@ -131,7 +132,6 @@
from lp.bugs.model.bugnomination import BugNomination
from lp.bugs.model.bugsubscription import BugSubscription
from lp.bugs.model.structuralsubscription import StructuralSubscription
-from lp.registry.enum import BugNotificationLevel
from lp.registry.interfaces.distribution import (
IDistribution,
IDistributionSet,
@@ -1422,7 +1422,7 @@
if tags == []:
return None
return ("EXISTS (SELECT TRUE FROM BugTag WHERE "
- "BugTag.bug = Bug.id AND BugTag.tag IN %s)"
+ "BugTag.bug = Bug.id AND BugTag.tag IN %s)"
% sqlvalues(sorted(tags)))
=== modified file 'lib/lp/bugs/model/tests/test_bug.py'
--- lib/lp/bugs/model/tests/test_bug.py 2011-01-21 08:12:29 +0000
+++ lib/lp/bugs/model/tests/test_bug.py 2011-02-01 15:29:39 +0000
@@ -4,8 +4,8 @@
__metaclass__ = type
from canonical.testing.layers import DatabaseFunctionalLayer
+from lp.bugs.enum import BugNotificationLevel
from lp.bugs.model.structuralsubscription import StructuralSubscription
-from lp.registry.enum import BugNotificationLevel
from lp.registry.interfaces.person import PersonVisibility
from lp.testing import (
login_person,
=== modified file 'lib/lp/bugs/model/tests/test_bugsubscriptionfilter.py'
--- lib/lp/bugs/model/tests/test_bugsubscriptionfilter.py 2011-02-01 15:29:38 +0000
+++ lib/lp/bugs/model/tests/test_bugsubscriptionfilter.py 2011-02-01 15:29:39 +0000
@@ -12,12 +12,12 @@
from canonical.launchpad import searchbuilder
from canonical.launchpad.interfaces.lpstorm import IStore
from canonical.testing import DatabaseFunctionalLayer
+from lp.bugs.enum import BugNotificationLevel
from lp.bugs.interfaces.bugtask import (
BugTaskImportance,
BugTaskStatus,
)
from lp.bugs.model.bugsubscriptionfilter import BugSubscriptionFilter
-from lp.registry.enum import BugNotificationLevel
from lp.testing import (
anonymous_logged_in,
login_person,
=== modified file 'lib/lp/bugs/model/tests/test_bugsubscriptioninfo.py'
--- lib/lp/bugs/model/tests/test_bugsubscriptioninfo.py 2010-12-06 20:58:55 +0000
+++ lib/lp/bugs/model/tests/test_bugsubscriptioninfo.py 2011-02-01 15:29:39 +0000
@@ -11,6 +11,7 @@
from testtools.matchers import Equals
from canonical.testing.layers import DatabaseFunctionalLayer
+from lp.bugs.enum import BugNotificationLevel
from lp.bugs.model.bug import (
BugSubscriberSet,
BugSubscriptionInfo,
@@ -18,7 +19,6 @@
load_people,
StructuralSubscriptionSet,
)
-from lp.registry.enum import BugNotificationLevel
from lp.registry.model.person import Person
from lp.testing import (
person_logged_in,
=== modified file 'lib/lp/bugs/model/tests/test_bugtask.py'
--- lib/lp/bugs/model/tests/test_bugtask.py 2011-02-01 15:29:38 +0000
+++ lib/lp/bugs/model/tests/test_bugtask.py 2011-02-01 15:29:39 +0000
@@ -25,6 +25,7 @@
LaunchpadZopelessLayer,
)
from lp.app.enums import ServiceUsage
+from lp.bugs.enum import BugNotificationLevel
from lp.bugs.interfaces.bug import IBugSet
from lp.bugs.interfaces.bugtarget import IBugTarget
from lp.bugs.interfaces.bugtask import (
@@ -47,7 +48,6 @@
HWBus,
IHWDeviceSet,
)
-from lp.registry.enum import BugNotificationLevel
from lp.registry.interfaces.distribution import IDistributionSet
from lp.registry.interfaces.person import (
IPerson,
=== modified file 'lib/lp/bugs/subscribers/bug.py'
--- lib/lp/bugs/subscribers/bug.py 2010-12-24 11:02:19 +0000
+++ lib/lp/bugs/subscribers/bug.py 2011-02-01 15:29:39 +0000
@@ -35,12 +35,12 @@
get_bug_changes,
)
from lp.bugs.adapters.bugdelta import BugDelta
+from lp.bugs.enum import BugNotificationLevel
from lp.bugs.interfaces.bugchange import IBugChange
from lp.bugs.interfaces.bugtask import IBugTaskSet
from lp.bugs.mail.bugnotificationbuilder import BugNotificationBuilder
from lp.bugs.mail.bugnotificationrecipients import BugNotificationRecipients
from lp.bugs.mail.newbug import generate_bug_add_email
-from lp.registry.enum import BugNotificationLevel
from lp.registry.interfaces.person import IPerson
=== modified file 'lib/lp/bugs/tests/test_bugchanges.py'
--- lib/lp/bugs/tests/test_bugchanges.py 2011-02-01 15:29:38 +0000
+++ lib/lp/bugs/tests/test_bugchanges.py 2011-02-01 15:29:39 +0000
@@ -20,13 +20,13 @@
from canonical.launchpad.webapp.interfaces import ILaunchBag
from canonical.launchpad.webapp.publisher import canonical_url
from canonical.testing.layers import LaunchpadFunctionalLayer
+from lp.bugs.enum import BugNotificationLevel
from lp.bugs.interfaces.bug import IBug
from lp.bugs.interfaces.bugtask import (
BugTaskImportance,
BugTaskStatus,
)
from lp.bugs.interfaces.cve import ICveSet
-from lp.registry.enum import BugNotificationLevel
from lp.testing.factory import LaunchpadObjectFactory
from lp.testing import person_logged_in
=== modified file 'lib/lp/bugs/tests/test_structuralsubscriptiontarget.py'
--- lib/lp/bugs/tests/test_structuralsubscriptiontarget.py 2011-02-01 15:29:38 +0000
+++ lib/lp/bugs/tests/test_structuralsubscriptiontarget.py 2011-02-01 15:29:39 +0000
@@ -27,6 +27,7 @@
LaunchpadFunctionalLayer,
LaunchpadZopelessLayer,
)
+from lp.bugs.enum import BugNotificationLevel
from lp.bugs.interfaces.bug import CreateBugParams
from lp.bugs.interfaces.bugtask import (
BugTaskImportance,
@@ -38,7 +39,6 @@
)
from lp.bugs.model.structuralsubscription import StructuralSubscription
from lp.bugs.tests.test_bugtarget import bugtarget_filebug
-from lp.registry.enum import BugNotificationLevel
from lp.registry.errors import (
DeleteSubscriptionError,
UserCannotSubscribePerson,
=== modified file 'lib/lp/registry/enum.py'
--- lib/lp/registry/enum.py 2010-09-17 18:17:29 +0000
+++ lib/lp/registry/enum.py 2011-02-01 15:29:39 +0000
@@ -6,7 +6,6 @@
__metaclass__ = type
__all__ = [
'PersonTransferJobType',
- 'BugNotificationLevel',
'DistroSeriesDifferenceStatus',
'DistroSeriesDifferenceType',
]
@@ -17,41 +16,6 @@
)
-class BugNotificationLevel(DBEnumeratedType):
- """Bug Notification Level.
-
- The type and volume of bug notification email sent to subscribers.
- """
-
- NOTHING = DBItem(10, """
- Nothing
-
- Don't send any notifications about bugs.
- """)
-
- LIFECYCLE = DBItem(20, """
- Lifecycle
-
- Only send a low volume of notifications about new bugs registered,
- bugs removed or bug targetting.
- """)
-
- METADATA = DBItem(30, """
- Details
-
- Send bug lifecycle notifications, as well as notifications about
- changes to the bug's details like status and description.
- """)
-
- COMMENTS = DBItem(40, """
- Discussion
-
- Send bug lifecycle notifications, detail change notifications and
- notifications about new events in the bugs's discussion, like new
- comments.
- """)
-
-
class DistroSeriesDifferenceStatus(DBEnumeratedType):
"""Distribution series difference status.