← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:blueprints-dbenum into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:blueprints-dbenum into launchpad:master.

Commit message:
lp.blueprints: 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/412099
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:blueprints-dbenum into launchpad:master.
diff --git a/lib/lp/blueprints/model/specification.py b/lib/lp/blueprints/model/specification.py
index b0e56c0..8d2e21c 100644
--- a/lib/lp/blueprints/model/specification.py
+++ b/lib/lp/blueprints/model/specification.py
@@ -86,7 +86,7 @@ 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 (
     convert_storm_clause_to_string,
@@ -177,10 +177,11 @@ class Specification(SQLBase, BugLinkTargetMixin, InformationTypeMixin):
     name = StringCol(unique=True, notNull=True)
     title = StringCol(notNull=True)
     summary = StringCol(notNull=True)
-    definition_status = EnumCol(
-        schema=SpecificationDefinitionStatus, notNull=True,
+    definition_status = DBEnum(
+        enum=SpecificationDefinitionStatus, allow_none=False,
         default=SpecificationDefinitionStatus.NEW)
-    priority = EnumCol(schema=SpecificationPriority, notNull=True,
+    priority = DBEnum(
+        enum=SpecificationPriority, allow_none=False,
         default=SpecificationPriority.UNDEFINED)
     _assignee = ForeignKey(dbName='assignee', notNull=False,
         foreignKey='Person',
@@ -203,7 +204,8 @@ class Specification(SQLBase, BugLinkTargetMixin, InformationTypeMixin):
         foreignKey='Distribution', notNull=False, default=None)
     distroseries = ForeignKey(dbName='distroseries',
         foreignKey='DistroSeries', notNull=False, default=None)
-    goalstatus = EnumCol(schema=SpecificationGoalStatus, notNull=True,
+    goalstatus = DBEnum(
+        enum=SpecificationGoalStatus, allow_none=False,
         default=SpecificationGoalStatus.PROPOSED)
     goal_proposer = ForeignKey(dbName='goal_proposer', notNull=False,
         foreignKey='Person',
@@ -219,8 +221,8 @@ class Specification(SQLBase, BugLinkTargetMixin, InformationTypeMixin):
     whiteboard = StringCol(notNull=False, default=None)
     direction_approved = BoolCol(notNull=True, default=False)
     man_days = IntCol(notNull=False, default=None)
-    implementation_status = EnumCol(
-        schema=SpecificationImplementationStatus, notNull=True,
+    implementation_status = DBEnum(
+        enum=SpecificationImplementationStatus, allow_none=False,
         default=SpecificationImplementationStatus.UNKNOWN)
     superseded_by = ForeignKey(dbName='superseded_by',
         foreignKey='Specification', notNull=False, default=None)
@@ -254,8 +256,8 @@ class Specification(SQLBase, BugLinkTargetMixin, InformationTypeMixin):
     dependencies = SQLRelatedJoin('Specification', joinColumn='specification',
         otherColumn='dependency', orderBy='title',
         intermediateTable='SpecificationDependency')
-    information_type = EnumCol(
-        enum=InformationType, notNull=True, default=InformationType.PUBLIC)
+    information_type = DBEnum(
+        enum=InformationType, allow_none=False, default=InformationType.PUBLIC)
 
     @cachedproperty
     def linked_branches(self):
diff --git a/lib/lp/blueprints/model/specificationworkitem.py b/lib/lp/blueprints/model/specificationworkitem.py
index 942dd35..1e2aed2 100644
--- a/lib/lp/blueprints/model/specificationworkitem.py
+++ b/lib/lp/blueprints/model/specificationworkitem.py
@@ -22,7 +22,7 @@ from lp.blueprints.interfaces.specificationworkitem import (
 from lp.registry.interfaces.person import validate_public_person
 from lp.services.database.constants import DEFAULT
 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.stormbase import StormBase
 from lp.services.helpers import backslashreplace
 
@@ -41,9 +41,9 @@ class SpecificationWorkItem(StormBase):
     assignee = Reference(assignee_id, 'Person.id')
     milestone_id = Int(name='milestone')
     milestone = Reference(milestone_id, 'Milestone.id')
-    status = EnumCol(
-        schema=SpecificationWorkItemStatus,
-        notNull=True, default=SpecificationWorkItemStatus.TODO)
+    status = DBEnum(
+        enum=SpecificationWorkItemStatus,
+        allow_none=False, default=SpecificationWorkItemStatus.TODO)
     date_created = UtcDateTimeCol(notNull=True, default=DEFAULT)
     sequence = Int(allow_none=False)
     deleted = Bool(allow_none=False, default=False)