launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #27648
[Merge] ~cjwatson/launchpad:snappy-dbenum into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:snappy-dbenum into launchpad:master.
Commit message:
lp.snappy: 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/411157
This is mainly intended as an example of how to convert these model definitions from the old SQLObject style to the new Storm style.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:snappy-dbenum into launchpad:master.
diff --git a/lib/lp/snappy/model/snapbuildjob.py b/lib/lp/snappy/model/snapbuildjob.py
index 4c522e1..4c4617f 100644
--- a/lib/lp/snappy/model/snapbuildjob.py
+++ b/lib/lp/snappy/model/snapbuildjob.py
@@ -33,7 +33,7 @@ from zope.interface import (
from lp.app.errors import NotFoundError
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 (
IMasterStore,
IStore,
@@ -86,7 +86,7 @@ class SnapBuildJob(StormBase):
snapbuild_id = Int(name='snapbuild', allow_none=False)
snapbuild = Reference(snapbuild_id, 'SnapBuild.id')
- job_type = EnumCol(enum=SnapBuildJobType, notNull=True)
+ job_type = DBEnum(enum=SnapBuildJobType, allow_none=False)
metadata = JSON('json_data', allow_none=False)
diff --git a/lib/lp/snappy/model/snapjob.py b/lib/lp/snappy/model/snapjob.py
index 3c6b33b..bf16b2d 100644
--- a/lib/lp/snappy/model/snapjob.py
+++ b/lib/lp/snappy/model/snapjob.py
@@ -37,7 +37,7 @@ from lp.registry.interfaces.pocket import PackagePublishingPocket
from lp.services.config import config
from lp.services.database.bulk import load_related
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 (
IMasterStore,
IStore,
@@ -91,7 +91,7 @@ class SnapJob(StormBase):
snap_id = Int(name='snap', allow_none=False)
snap = Reference(snap_id, 'Snap.id')
- job_type = EnumCol(enum=SnapJobType, notNull=True)
+ job_type = DBEnum(enum=SnapJobType, allow_none=False)
metadata = JSON('json_data', allow_none=False)
diff --git a/lib/lp/snappy/model/snappyseries.py b/lib/lp/snappy/model/snappyseries.py
index e36fa96..52de880 100644
--- a/lib/lp/snappy/model/snappyseries.py
+++ b/lib/lp/snappy/model/snappyseries.py
@@ -25,7 +25,7 @@ from zope.interface import implementer
from lp.registry.interfaces.series import SeriesStatus
from lp.registry.model.distroseries import DistroSeries
from lp.services.database.constants import DEFAULT
-from lp.services.database.enumcol import EnumCol
+from lp.services.database.enumcol import DBEnum
from lp.services.database.interfaces import (
IMasterStore,
IStore,
@@ -61,7 +61,7 @@ class SnappySeries(Storm):
display_name = Unicode(name='display_name', allow_none=False)
- status = EnumCol(enum=SeriesStatus, notNull=True)
+ status = DBEnum(enum=SeriesStatus, allow_none=False)
def __init__(self, registrant, name, display_name, status,
preferred_distro_series=None, date_created=DEFAULT):