launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #27691
[Merge] ~cjwatson/launchpad:bugs-dbenum into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:bugs-dbenum into launchpad:master.
Commit message:
lp.bugs: Use DBEnum rather than EnumCol
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/411549
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:bugs-dbenum into launchpad:master.
diff --git a/lib/lp/bugs/model/apportjob.py b/lib/lp/bugs/model/apportjob.py
index 29448ab..5b94879 100644
--- a/lib/lp/bugs/model/apportjob.py
+++ b/lib/lp/bugs/model/apportjob.py
@@ -38,7 +38,7 @@ from lp.bugs.utilities.filebugdataparser import (
FileBugDataParser,
)
from lp.services.config import config
-from lp.services.database.enumcol import EnumCol
+from lp.services.database.enumcol import DBEnum
from lp.services.database.interfaces import IStore
from lp.services.database.stormbase import StormBase
from lp.services.job.model.job import (
@@ -64,7 +64,7 @@ class ApportJob(StormBase):
blob_id = Int(name='blob')
blob = Reference(blob_id, TemporaryBlobStorage.id)
- job_type = EnumCol(enum=ApportJobType, notNull=True)
+ job_type = DBEnum(enum=ApportJobType, allow_none=False)
_json_data = Unicode('json_data')
diff --git a/lib/lp/bugs/model/bug.py b/lib/lp/bugs/model/bug.py
index 8434876..6088100 100644
--- a/lib/lp/bugs/model/bug.py
+++ b/lib/lp/bugs/model/bug.py
@@ -193,7 +193,7 @@ from lp.services.database import bulk
from lp.services.database.constants import UTC_NOW
from lp.services.database.datetimecol import UtcDateTimeCol
from lp.services.database.decoratedresultset import DecoratedResultSet
-from lp.services.database.enumcol import EnumCol
+from lp.services.database.enumcol import DBEnum
from lp.services.database.interfaces import IStore
from lp.services.database.sqlbase import (
SQLBase,
@@ -363,8 +363,8 @@ class Bug(SQLBase, InformationTypeMixin):
who_made_private = ForeignKey(
dbName='who_made_private', foreignKey='Person',
storm_validator=validate_public_person, default=None)
- information_type = EnumCol(
- enum=InformationType, notNull=True, default=InformationType.PUBLIC)
+ information_type = DBEnum(
+ enum=InformationType, allow_none=False, default=InformationType.PUBLIC)
# useful Joins
activity = SQLMultipleJoin('BugActivity', joinColumn='bug', orderBy='id')
diff --git a/lib/lp/bugs/model/bugattachment.py b/lib/lp/bugs/model/bugattachment.py
index 723fa09..bfd85dc 100644
--- a/lib/lp/bugs/model/bugattachment.py
+++ b/lib/lp/bugs/model/bugattachment.py
@@ -17,7 +17,7 @@ from lp.bugs.interfaces.bugattachment import (
IBugAttachment,
IBugAttachmentSet,
)
-from lp.services.database.enumcol import EnumCol
+from lp.services.database.enumcol import DBEnum
from lp.services.database.sqlbase import SQLBase
from lp.services.database.sqlobject import (
ForeignKey,
@@ -35,8 +35,8 @@ class BugAttachment(SQLBase):
bug = ForeignKey(
foreignKey='Bug', dbName='bug', notNull=True)
- type = EnumCol(
- schema=BugAttachmentType, notNull=True,
+ type = DBEnum(
+ enum=BugAttachmentType, allow_none=False,
default=IBugAttachment['type'].default)
title = StringCol(notNull=True)
libraryfile = ForeignKey(
diff --git a/lib/lp/bugs/model/bugsummary.py b/lib/lp/bugs/model/bugsummary.py
index 46b29a9..029e429 100644
--- a/lib/lp/bugs/model/bugsummary.py
+++ b/lib/lp/bugs/model/bugsummary.py
@@ -48,7 +48,7 @@ from lp.registry.model.product import Product
from lp.registry.model.productseries import ProductSeries
from lp.registry.model.sourcepackagename import SourcePackageName
from lp.registry.model.teammembership import TeamParticipation
-from lp.services.database.enumcol import EnumCol
+from lp.services.database.enumcol import DBEnum
@implementer(IBugSummary)
@@ -81,10 +81,9 @@ class BugSummary(Storm):
milestone_id = Int(name='milestone')
milestone = Reference(milestone_id, Milestone.id)
- status = EnumCol(
- dbName='status', schema=(BugTaskStatus, BugTaskStatusSearch))
+ status = DBEnum(name='status', enum=(BugTaskStatus, BugTaskStatusSearch))
- importance = EnumCol(dbName='importance', schema=BugTaskImportance)
+ importance = DBEnum(name='importance', enum=BugTaskImportance)
tag = Unicode()
diff --git a/lib/lp/bugs/model/bugtaskflat.py b/lib/lp/bugs/model/bugtaskflat.py
index 01e26e4..247b6d0 100644
--- a/lib/lp/bugs/model/bugtaskflat.py
+++ b/lib/lp/bugs/model/bugtaskflat.py
@@ -16,7 +16,7 @@ from lp.bugs.interfaces.bugtask import (
BugTaskStatus,
BugTaskStatusSearch,
)
-from lp.services.database.enumcol import EnumCol
+from lp.services.database.enumcol import DBEnum
class BugTaskFlat(Storm):
@@ -35,7 +35,7 @@ class BugTaskFlat(Storm):
duplicateof = Reference(duplicateof_id, 'Bug.id')
bug_owner_id = Int(name='bug_owner')
bug_owner = Reference(bug_owner_id, 'Person.id')
- information_type = EnumCol(enum=InformationType)
+ information_type = DBEnum(enum=InformationType)
heat = Int()
product_id = Int(name='product')
product = Reference(product_id, 'Product.id')
@@ -50,8 +50,8 @@ class BugTaskFlat(Storm):
sourcepackagename_id, 'SourcePackageName.id')
ociproject_id = Int(name='ociproject')
ociproject = Reference(ociproject_id, 'OCIProject.id')
- status = EnumCol(schema=(BugTaskStatus, BugTaskStatusSearch))
- importance = EnumCol(schema=BugTaskImportance)
+ status = DBEnum(enum=(BugTaskStatus, BugTaskStatusSearch))
+ importance = DBEnum(enum=BugTaskImportance)
assignee_id = Int(name='assignee')
assignee = Reference(assignee_id, 'Person.id')
milestone_id = Int(name='milestone')
diff --git a/lib/lp/bugs/model/bugtracker.py b/lib/lp/bugs/model/bugtracker.py
index c3c5988..d89145d 100644
--- a/lib/lp/bugs/model/bugtracker.py
+++ b/lib/lp/bugs/model/bugtracker.py
@@ -66,7 +66,7 @@ from lp.registry.model.product import (
ProductSet,
)
from lp.registry.model.projectgroup import ProjectGroup
-from lp.services.database.enumcol import EnumCol
+from lp.services.database.enumcol import DBEnum
from lp.services.database.interfaces import IStore
from lp.services.database.sqlbase import (
flush_database_updates,
@@ -307,8 +307,8 @@ class BugTracker(SQLBase):
_table = 'BugTracker'
- bugtrackertype = EnumCol(
- dbName='bugtrackertype', schema=BugTrackerType, notNull=True)
+ bugtrackertype = DBEnum(
+ name='bugtrackertype', enum=BugTrackerType, allow_none=False)
name = StringCol(notNull=True, unique=True)
title = StringCol(notNull=True)
summary = StringCol(notNull=False)
diff --git a/lib/lp/bugs/model/bugwatch.py b/lib/lp/bugs/model/bugwatch.py
index 93a8f83..da5f814 100644
--- a/lib/lp/bugs/model/bugwatch.py
+++ b/lib/lp/bugs/model/bugwatch.py
@@ -60,7 +60,7 @@ from lp.registry.interfaces.person import validate_public_person
from lp.services.database import bulk
from lp.services.database.constants import UTC_NOW
from lp.services.database.datetimecol import UtcDateTimeCol
-from lp.services.database.enumcol import EnumCol
+from lp.services.database.enumcol import DBEnum
from lp.services.database.interfaces import IStore
from lp.services.database.sqlbase import SQLBase
from lp.services.database.sqlobject import (
@@ -130,7 +130,7 @@ class BugWatch(SQLBase):
remote_importance = StringCol(notNull=False, default=None)
lastchanged = UtcDateTimeCol(notNull=False, default=None)
lastchecked = UtcDateTimeCol(notNull=False, default=None)
- last_error_type = EnumCol(schema=BugWatchActivityStatus, default=None)
+ last_error_type = DBEnum(enum=BugWatchActivityStatus, default=None)
datecreated = UtcDateTimeCol(notNull=True, default=UTC_NOW)
owner = ForeignKey(
dbName='owner', foreignKey='Person',
@@ -781,6 +781,6 @@ class BugWatchActivity(StormBase):
bug_watch_id = Int(name='bug_watch')
bug_watch = Reference(bug_watch_id, BugWatch.id)
activity_date = UtcDateTimeCol(notNull=True)
- result = EnumCol(enum=BugWatchActivityStatus, notNull=False)
+ result = DBEnum(enum=BugWatchActivityStatus, allow_none=True)
message = Unicode()
oops_id = Unicode()
Follow ups