launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #27741
[Merge] ~cjwatson/launchpad:registry-dbenum into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:registry-dbenum into launchpad:master.
Commit message:
lp.registry: 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/412091
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:registry-dbenum into launchpad:master.
diff --git a/lib/lp/registry/model/distribution.py b/lib/lp/registry/model/distribution.py
index 4f00e9b..dc9838f 100644
--- a/lib/lp/registry/model/distribution.py
+++ b/lib/lp/registry/model/distribution.py
@@ -146,7 +146,7 @@ from lp.services.database.bulk import load_referencing
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,
@@ -262,9 +262,9 @@ class Distribution(SQLBase, BugTargetBase, MakesAnnouncements,
translationgroup = ForeignKey(
dbName='translationgroup', foreignKey='TranslationGroup',
notNull=False, default=None)
- translationpermission = EnumCol(
- dbName='translationpermission', notNull=True,
- schema=TranslationPermission, default=TranslationPermission.OPEN)
+ translationpermission = DBEnum(
+ name='translationpermission', allow_none=False,
+ enum=TranslationPermission, default=TranslationPermission.OPEN)
active = True
official_packages = BoolCol(notNull=True, default=False)
supports_ppas = BoolCol(notNull=True, default=False)
@@ -272,9 +272,9 @@ class Distribution(SQLBase, BugTargetBase, MakesAnnouncements,
package_derivatives_email = StringCol(notNull=False, default=None)
redirect_release_uploads = BoolCol(notNull=True, default=False)
development_series_alias = StringCol(notNull=False, default=None)
- vcs = EnumCol(enum=VCSType, notNull=False)
- default_traversal_policy = EnumCol(
- enum=DistributionDefaultTraversalPolicy, notNull=False,
+ vcs = DBEnum(enum=VCSType, allow_none=True)
+ default_traversal_policy = DBEnum(
+ enum=DistributionDefaultTraversalPolicy, allow_none=True,
default=DistributionDefaultTraversalPolicy.SERIES)
redirect_default_traversal = BoolCol(notNull=False, default=False)
oci_registry_credentials_id = Int(name='oci_credentials', allow_none=True)
@@ -379,9 +379,9 @@ class Distribution(SQLBase, BugTargetBase, MakesAnnouncements,
self.translations_usage == ServiceUsage.LAUNCHPAD,
self.official_blueprints, self.official_answers)
- _answers_usage = EnumCol(
- dbName="answers_usage", notNull=True,
- schema=ServiceUsage, default=ServiceUsage.UNKNOWN)
+ _answers_usage = DBEnum(
+ name="answers_usage", allow_none=False,
+ enum=ServiceUsage, default=ServiceUsage.UNKNOWN)
def _get_answers_usage(self):
if self._answers_usage != ServiceUsage.UNKNOWN:
@@ -403,10 +403,9 @@ class Distribution(SQLBase, BugTargetBase, MakesAnnouncements,
_set_answers_usage,
doc="Indicates if the product uses the answers service.")
- _blueprints_usage = EnumCol(
- dbName="blueprints_usage", notNull=True,
- schema=ServiceUsage,
- default=ServiceUsage.UNKNOWN)
+ _blueprints_usage = DBEnum(
+ name="blueprints_usage", allow_none=False,
+ enum=ServiceUsage, default=ServiceUsage.UNKNOWN)
def _get_blueprints_usage(self):
if self._blueprints_usage != ServiceUsage.UNKNOWN:
@@ -428,9 +427,9 @@ class Distribution(SQLBase, BugTargetBase, MakesAnnouncements,
_set_blueprints_usage,
doc="Indicates if the product uses the blueprints service.")
- translations_usage = EnumCol(
- dbName="translations_usage", notNull=True,
- schema=ServiceUsage, default=ServiceUsage.UNKNOWN)
+ translations_usage = DBEnum(
+ name="translations_usage", allow_none=False,
+ enum=ServiceUsage, default=ServiceUsage.UNKNOWN)
@property
def codehosting_usage(self):
diff --git a/lib/lp/registry/model/distributionmirror.py b/lib/lp/registry/model/distributionmirror.py
index 85e44ba..8d3bd82 100644
--- a/lib/lp/registry/model/distributionmirror.py
+++ b/lib/lp/registry/model/distributionmirror.py
@@ -62,7 +62,7 @@ from lp.registry.interfaces.sourcepackage import SourcePackageFileType
from lp.services.config import config
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,
@@ -136,16 +136,17 @@ class DistributionMirror(SQLBase):
notNull=False, default=None, unique=True)
enabled = BoolCol(
notNull=True, default=False)
- speed = EnumCol(
- notNull=True, enum=MirrorSpeed)
+ speed = DBEnum(
+ allow_none=False, enum=MirrorSpeed)
country = ForeignKey(
dbName='country', foreignKey='Country', notNull=True)
- content = EnumCol(
- notNull=True, enum=MirrorContent)
+ content = DBEnum(
+ allow_none=False, enum=MirrorContent)
official_candidate = BoolCol(
notNull=True, default=False)
- status = EnumCol(
- notNull=True, default=MirrorStatus.PENDING_REVIEW, enum=MirrorStatus)
+ status = DBEnum(
+ allow_none=False, default=MirrorStatus.PENDING_REVIEW,
+ enum=MirrorStatus)
date_created = UtcDateTimeCol(notNull=True, default=UTC_NOW)
date_reviewed = UtcDateTimeCol(default=None)
whiteboard = StringCol(
@@ -821,10 +822,11 @@ class MirrorDistroArchSeries(SQLBase, _MirrorSeriesMixIn):
notNull=True)
component = ForeignKey(
dbName='component', foreignKey='Component', notNull=True)
- freshness = EnumCol(
- notNull=True, default=MirrorFreshness.UNKNOWN, enum=MirrorFreshness)
- pocket = EnumCol(
- notNull=True, schema=PackagePublishingPocket)
+ freshness = DBEnum(
+ allow_none=False, default=MirrorFreshness.UNKNOWN,
+ enum=MirrorFreshness)
+ pocket = DBEnum(
+ allow_none=False, enum=PackagePublishingPocket)
def getLatestPublishingEntry(self, time_interval, deb_only=True):
"""Return the BinaryPackagePublishingHistory record with the
@@ -894,10 +896,11 @@ class MirrorDistroSeriesSource(SQLBase, _MirrorSeriesMixIn):
notNull=True)
component = ForeignKey(
dbName='component', foreignKey='Component', notNull=True)
- freshness = EnumCol(
- notNull=True, default=MirrorFreshness.UNKNOWN, enum=MirrorFreshness)
- pocket = EnumCol(
- notNull=True, schema=PackagePublishingPocket)
+ freshness = DBEnum(
+ allow_none=False, default=MirrorFreshness.UNKNOWN,
+ enum=MirrorFreshness)
+ pocket = DBEnum(
+ allow_none=False, enum=PackagePublishingPocket)
def getLatestPublishingEntry(self, time_interval):
clauses = [
diff --git a/lib/lp/registry/model/distroseries.py b/lib/lp/registry/model/distroseries.py
index be223c7..2ad609c 100644
--- a/lib/lp/registry/model/distroseries.py
+++ b/lib/lp/registry/model/distroseries.py
@@ -97,7 +97,7 @@ from lp.services.database.constants import (
)
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,
@@ -234,8 +234,8 @@ class DistroSeries(SQLBase, BugTargetBase, HasSpecificationsMixin,
title = StringCol(notNull=True)
description = StringCol(notNull=True)
version = StringCol(notNull=True)
- status = EnumCol(
- dbName='releasestatus', notNull=True, schema=SeriesStatus)
+ status = DBEnum(
+ name='releasestatus', allow_none=False, enum=SeriesStatus)
date_created = UtcDateTimeCol(notNull=False, default=UTC_NOW)
datereleased = UtcDateTimeCol(notNull=False, default=None)
previous_series = ForeignKey(
diff --git a/lib/lp/registry/model/distroseriesparent.py b/lib/lp/registry/model/distroseriesparent.py
index a632004..6b30664 100644
--- a/lib/lp/registry/model/distroseriesparent.py
+++ b/lib/lp/registry/model/distroseriesparent.py
@@ -22,7 +22,7 @@ from lp.registry.interfaces.distroseriesparent import (
IDistroSeriesParentSet,
)
from lp.registry.interfaces.pocket import PackagePublishingPocket
-from lp.services.database.enumcol import EnumCol
+from lp.services.database.enumcol import DBEnum
from lp.services.database.interfaces import (
IMasterStore,
IStore,
@@ -47,9 +47,8 @@ class DistroSeriesParent(Storm):
is_overlay = Bool(allow_none=False, default=False)
inherit_overrides = Bool(allow_none=False, default=False)
- pocket = EnumCol(
- dbName='pocket', notNull=False,
- schema=PackagePublishingPocket)
+ pocket = DBEnum(
+ name='pocket', allow_none=True, enum=PackagePublishingPocket)
component_id = Int(name='component', allow_none=True)
component = Reference(component_id, 'Component.id')
diff --git a/lib/lp/registry/model/gpgkey.py b/lib/lp/registry/model/gpgkey.py
index a786891..48aa4e7 100644
--- a/lib/lp/registry/model/gpgkey.py
+++ b/lib/lp/registry/model/gpgkey.py
@@ -10,7 +10,7 @@ from lp.registry.interfaces.gpg import (
IGPGKey,
IGPGKeySet,
)
-from lp.services.database.enumcol import EnumCol
+from lp.services.database.enumcol import DBEnum
from lp.services.database.sqlbase import (
SQLBase,
sqlvalues,
@@ -40,8 +40,8 @@ class GPGKey(SQLBase):
keysize = IntCol(dbName='keysize', notNull=True)
- algorithm = EnumCol(dbName='algorithm', notNull=True,
- enum=GPGKeyAlgorithm)
+ algorithm = DBEnum(name='algorithm', allow_none=False,
+ enum=GPGKeyAlgorithm)
active = BoolCol(dbName='active', notNull=True)
diff --git a/lib/lp/registry/model/packaging.py b/lib/lp/registry/model/packaging.py
index 9e40e22..6c7aacf 100644
--- a/lib/lp/registry/model/packaging.py
+++ b/lib/lp/registry/model/packaging.py
@@ -26,7 +26,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.sqlbase import SQLBase
from lp.services.database.sqlobject import ForeignKey
from lp.services.webapp.interfaces import ILaunchBag
@@ -48,8 +48,7 @@ class Packaging(SQLBase):
distroseries = ForeignKey(foreignKey='DistroSeries',
dbName='distroseries',
notNull=True)
- packaging = EnumCol(dbName='packaging', notNull=True,
- enum=PackagingType)
+ packaging = DBEnum(name='packaging', allow_none=False, enum=PackagingType)
datecreated = UtcDateTimeCol(notNull=True, default=UTC_NOW)
owner = ForeignKey(
dbName='owner', foreignKey='Person',
diff --git a/lib/lp/registry/model/person.py b/lib/lp/registry/model/person.py
index 4d0dcdc..b9f519e 100644
--- a/lib/lp/registry/model/person.py
+++ b/lib/lp/registry/model/person.py
@@ -249,7 +249,7 @@ from lp.services.database import (
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.policy import PrimaryDatabasePolicy
from lp.services.database.sqlbase import (
@@ -597,24 +597,24 @@ class Person(
sshkeys = SQLMultipleJoin('SSHKey', joinColumn='person')
- renewal_policy = EnumCol(
+ renewal_policy = DBEnum(
enum=TeamMembershipRenewalPolicy,
default=TeamMembershipRenewalPolicy.NONE)
- membership_policy = EnumCol(
- dbName='subscriptionpolicy', enum=TeamMembershipPolicy,
+ membership_policy = DBEnum(
+ name='subscriptionpolicy', enum=TeamMembershipPolicy,
default=TeamMembershipPolicy.RESTRICTED,
- storm_validator=validate_membership_policy)
+ validator=validate_membership_policy)
defaultrenewalperiod = IntCol(dbName='defaultrenewalperiod', default=None)
defaultmembershipperiod = IntCol(
dbName='defaultmembershipperiod', default=None)
- mailing_list_auto_subscribe_policy = EnumCol(
+ mailing_list_auto_subscribe_policy = DBEnum(
enum=MailingListAutoSubscribePolicy,
default=MailingListAutoSubscribePolicy.ON_REGISTRATION)
merged = ForeignKey(dbName='merged', foreignKey='Person', default=None)
datecreated = UtcDateTimeCol(notNull=True, default=UTC_NOW)
- creation_rationale = EnumCol(enum=PersonCreationRationale, default=None)
+ creation_rationale = DBEnum(enum=PersonCreationRationale, default=None)
creation_comment = StringCol(default=None)
registrant = ForeignKey(
dbName='registrant', foreignKey='Person', default=None,
@@ -626,12 +626,13 @@ class Person(
_ircnicknames = SQLMultipleJoin('IrcID', joinColumn='person')
jabberids = SQLMultipleJoin('JabberID', joinColumn='person')
- visibility = EnumCol(
+ visibility = DBEnum(
enum=PersonVisibility, default=PersonVisibility.PUBLIC,
- storm_validator=validate_person_visibility)
+ validator=validate_person_visibility)
- personal_standing = EnumCol(
- enum=PersonalStanding, default=PersonalStanding.UNKNOWN, notNull=True)
+ personal_standing = DBEnum(
+ enum=PersonalStanding, default=PersonalStanding.UNKNOWN,
+ allow_none=False)
personal_standing_reason = StringCol(default=None)
@@ -4316,7 +4317,7 @@ class SSHKey(SQLBase):
_table = 'SSHKey'
person = ForeignKey(foreignKey='Person', dbName='person', notNull=True)
- keytype = EnumCol(dbName='keytype', notNull=True, enum=SSHKeyType)
+ keytype = DBEnum(name='keytype', allow_none=False, enum=SSHKeyType)
keytext = StringCol(dbName='keytext', notNull=True)
comment = StringCol(dbName='comment', notNull=True)
diff --git a/lib/lp/registry/model/persontransferjob.py b/lib/lp/registry/model/persontransferjob.py
index 75d7b56..69e44ac 100644
--- a/lib/lp/registry/model/persontransferjob.py
+++ b/lib/lp/registry/model/persontransferjob.py
@@ -66,7 +66,7 @@ from lp.registry.personmerge import merge_people
from lp.registry.scripts.closeaccount import close_account
from lp.services.config import config
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,
@@ -98,7 +98,7 @@ class PersonTransferJob(StormBase):
minor_person_id = Int(name='minor_person')
minor_person = Reference(minor_person_id, Person.id)
- job_type = EnumCol(enum=PersonTransferJobType, notNull=True)
+ job_type = DBEnum(enum=PersonTransferJobType, allow_none=False)
_json_data = Unicode('json_data')
diff --git a/lib/lp/registry/model/product.py b/lib/lp/registry/model/product.py
index 5956904..471b997 100644
--- a/lib/lp/registry/model/product.py
+++ b/lib/lp/registry/model/product.py
@@ -179,7 +179,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,
@@ -346,9 +346,9 @@ class Product(SQLBase, BugTargetBase, MakesAnnouncements,
translationgroup = ForeignKey(
dbName='translationgroup', foreignKey='TranslationGroup',
notNull=False, default=None)
- translationpermission = EnumCol(
- dbName='translationpermission', notNull=True,
- schema=TranslationPermission, default=TranslationPermission.OPEN)
+ translationpermission = DBEnum(
+ name='translationpermission', allow_none=False,
+ enum=TranslationPermission, default=TranslationPermission.OPEN)
translation_focus = ForeignKey(
dbName='translation_focus', foreignKey='ProductSeries',
notNull=False, default=None)
@@ -363,7 +363,7 @@ class Product(SQLBase, BugTargetBase, MakesAnnouncements,
dbName='official_malone', notNull=True, default=False)
remote_product = Unicode(
name='remote_product', allow_none=True, default=None)
- vcs = EnumCol(enum=VCSType, notNull=False)
+ vcs = DBEnum(enum=VCSType, allow_none=True)
# Cache of AccessPolicy.ids that convey launchpad.LimitedView.
# Unlike artifacts' cached access_policies, an AccessArtifactGrant
@@ -498,10 +498,9 @@ class Product(SQLBase, BugTargetBase, MakesAnnouncements,
yield CannotChangeInformationType(
'Bug supervisor has inclusive membership.')
- _information_type = EnumCol(
+ _information_type = DBEnum(
enum=InformationType, default=InformationType.PUBLIC,
- dbName="information_type",
- storm_validator=_valid_product_information_type)
+ name="information_type", validator=_valid_product_information_type)
def _get_information_type(self):
return self._information_type or InformationType.PUBLIC
@@ -554,14 +553,12 @@ class Product(SQLBase, BugTargetBase, MakesAnnouncements,
self.official_blueprints, self.official_answers,
self.official_codehosting)
- _answers_usage = EnumCol(
- dbName="answers_usage", notNull=True,
- schema=ServiceUsage,
- default=ServiceUsage.UNKNOWN)
- _blueprints_usage = EnumCol(
- dbName="blueprints_usage", notNull=True,
- schema=ServiceUsage,
- default=ServiceUsage.UNKNOWN)
+ _answers_usage = DBEnum(
+ name="answers_usage", allow_none=False,
+ enum=ServiceUsage, default=ServiceUsage.UNKNOWN)
+ _blueprints_usage = DBEnum(
+ name="blueprints_usage", allow_none=False,
+ enum=ServiceUsage, default=ServiceUsage.UNKNOWN)
def validate_translations_usage(self, attr, value):
if value == ServiceUsage.LAUNCHPAD and self.private:
@@ -569,11 +566,10 @@ class Product(SQLBase, BugTargetBase, MakesAnnouncements,
"Translations are not supported for proprietary products.")
return value
- translations_usage = EnumCol(
- dbName="translations_usage", notNull=True,
- schema=ServiceUsage,
- default=ServiceUsage.UNKNOWN,
- storm_validator=validate_translations_usage)
+ translations_usage = DBEnum(
+ name="translations_usage", allow_none=False,
+ enum=ServiceUsage, default=ServiceUsage.UNKNOWN,
+ validator=validate_translations_usage)
@property
def codehosting_usage(self):
@@ -620,12 +616,12 @@ class Product(SQLBase, BugTargetBase, MakesAnnouncements,
project_reviewed = BoolCol(dbName='reviewed', notNull=True, default=False)
reviewer_whiteboard = StringCol(notNull=False, default=None)
private_bugs = False
- bug_sharing_policy = EnumCol(
- enum=BugSharingPolicy, notNull=False, default=None)
- branch_sharing_policy = EnumCol(
- enum=BranchSharingPolicy, notNull=False, default=None)
- specification_sharing_policy = EnumCol(
- enum=SpecificationSharingPolicy, notNull=False,
+ bug_sharing_policy = DBEnum(
+ enum=BugSharingPolicy, allow_none=True, default=None)
+ branch_sharing_policy = DBEnum(
+ enum=BranchSharingPolicy, allow_none=True, default=None)
+ specification_sharing_policy = DBEnum(
+ enum=SpecificationSharingPolicy, allow_none=True,
default=SpecificationSharingPolicy.PUBLIC)
autoupdate = BoolCol(dbName='autoupdate', notNull=True, default=False)
freshmeatproject = None
diff --git a/lib/lp/registry/model/productjob.py b/lib/lp/registry/model/productjob.py
index a24eccc..6aceb0b 100644
--- a/lib/lp/registry/model/productjob.py
+++ b/lib/lp/registry/model/productjob.py
@@ -64,7 +64,7 @@ from lp.registry.model.commercialsubscription import CommercialSubscription
from lp.registry.model.product import Product
from lp.services.config import config
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,
@@ -136,7 +136,7 @@ class ProductJob(StormBase):
product_id = Int(name='product')
product = Reference(product_id, Product.id)
- job_type = EnumCol(enum=ProductJobType, notNull=True)
+ job_type = DBEnum(enum=ProductJobType, allow_none=False)
_json_data = Unicode('json_data')
diff --git a/lib/lp/registry/model/productlicense.py b/lib/lp/registry/model/productlicense.py
index 726808d..3b14c4a 100644
--- a/lib/lp/registry/model/productlicense.py
+++ b/lib/lp/registry/model/productlicense.py
@@ -12,7 +12,7 @@ from zope.interface import implementer
from lp.registry.interfaces.product import License
from lp.registry.interfaces.productlicense import IProductLicense
-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
@@ -22,4 +22,4 @@ class ProductLicense(SQLBase):
"""A product's licence."""
product = ForeignKey(dbName='product', foreignKey='Product', notNull=True)
- license = EnumCol(dbName='license', notNull=True, schema=License)
+ license = DBEnum(name='license', allow_none=False, enum=License)
diff --git a/lib/lp/registry/model/productrelease.py b/lib/lp/registry/model/productrelease.py
index 14394c5..3b88d33 100644
--- a/lib/lp/registry/model/productrelease.py
+++ b/lib/lp/registry/model/productrelease.py
@@ -40,7 +40,7 @@ from lp.registry.interfaces.productrelease import (
)
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,
@@ -227,8 +227,8 @@ class ProductReleaseFile(SQLBase):
signature = ForeignKey(dbName='signature',
foreignKey='LibraryFileAlias')
- filetype = EnumCol(dbName='filetype', enum=UpstreamFileType,
- notNull=True, default=UpstreamFileType.CODETARBALL)
+ filetype = DBEnum(name='filetype', enum=UpstreamFileType,
+ allow_none=False, default=UpstreamFileType.CODETARBALL)
description = StringCol(notNull=False, default=None)
diff --git a/lib/lp/registry/model/productseries.py b/lib/lp/registry/model/productseries.py
index 4cfbda8..cf28a82 100644
--- a/lib/lp/registry/model/productseries.py
+++ b/lib/lp/registry/model/productseries.py
@@ -63,7 +63,7 @@ from lp.registry.model.series import SeriesMixin
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
from lp.services.database.sqlobject import (
@@ -118,8 +118,8 @@ class ProductSeries(SQLBase, BugTargetBase, HasMilestonesMixin,
_table = 'ProductSeries'
product = ForeignKey(dbName='product', foreignKey='Product', notNull=True)
- status = EnumCol(
- notNull=True, schema=SeriesStatus,
+ status = DBEnum(
+ allow_none=False, enum=SeriesStatus,
default=SeriesStatus.DEVELOPMENT)
name = StringCol(notNull=True)
datecreated = UtcDateTimeCol(notNull=True, default=UTC_NOW)
@@ -145,12 +145,12 @@ class ProductSeries(SQLBase, BugTargetBase, HasMilestonesMixin,
' proprietary projects.')
return value
- translations_autoimport_mode = EnumCol(
- dbName='translations_autoimport_mode',
- notNull=True,
- schema=TranslationsBranchImportMode,
+ translations_autoimport_mode = DBEnum(
+ name='translations_autoimport_mode',
+ allow_none=False,
+ enum=TranslationsBranchImportMode,
default=TranslationsBranchImportMode.NO_IMPORT,
- storm_validator=validate_autoimport_mode)
+ validator=validate_autoimport_mode)
translations_branch = ForeignKey(
dbName='translations_branch', foreignKey='Branch', notNull=False,
default=None)
diff --git a/lib/lp/registry/model/projectgroup.py b/lib/lp/registry/model/projectgroup.py
index ad1b010..421692e 100644
--- a/lib/lp/registry/model/projectgroup.py
+++ b/lib/lp/registry/model/projectgroup.py
@@ -87,7 +87,7 @@ from lp.registry.model.product import (
from lp.registry.model.productseries import ProductSeries
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,
@@ -156,8 +156,9 @@ class ProjectGroup(SQLBase, BugTargetBase, HasSpecificationsMixin,
lastdoap = StringCol(dbName='lastdoap', notNull=False, default=None)
translationgroup = ForeignKey(dbName='translationgroup',
foreignKey='TranslationGroup', notNull=False, default=None)
- translationpermission = EnumCol(dbName='translationpermission',
- notNull=True, schema=TranslationPermission,
+ translationpermission = DBEnum(
+ name='translationpermission',
+ allow_none=False, enum=TranslationPermission,
default=TranslationPermission.OPEN)
active = BoolCol(dbName='active', notNull=True, default=True)
reviewed = BoolCol(dbName='reviewed', notNull=True, default=False)
diff --git a/lib/lp/registry/model/sharingjob.py b/lib/lp/registry/model/sharingjob.py
index 10fe2e3..66eea40 100644
--- a/lib/lp/registry/model/sharingjob.py
+++ b/lib/lp/registry/model/sharingjob.py
@@ -85,7 +85,7 @@ from lp.registry.model.person import Person
from lp.registry.model.product import Product
from lp.registry.model.teammembership import TeamParticipation
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.sqlobject import SQLObjectNotFound
from lp.services.database.stormbase import StormBase
@@ -144,7 +144,7 @@ class SharingJob(StormBase):
grantee_id = Int(name='grantee')
grantee = Reference(grantee_id, Person.id)
- job_type = EnumCol(enum=SharingJobType, notNull=True)
+ job_type = DBEnum(enum=SharingJobType, allow_none=False)
_json_data = Unicode('json_data')
diff --git a/lib/lp/registry/model/teammembership.py b/lib/lp/registry/model/teammembership.py
index 3d5f53f..ab4c4cb 100644
--- a/lib/lp/registry/model/teammembership.py
+++ b/lib/lp/registry/model/teammembership.py
@@ -49,7 +49,7 @@ from lp.registry.interfaces.teammembership import (
)
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 (
cursor,
@@ -86,8 +86,8 @@ class TeamMembership(SQLBase):
reviewed_by = ForeignKey(
dbName='reviewed_by', foreignKey='Person',
storm_validator=validate_public_person, default=None)
- status = EnumCol(
- dbName='status', notNull=True, enum=TeamMembershipStatus)
+ status = DBEnum(
+ name='status', allow_none=False, enum=TeamMembershipStatus)
# XXX: salgado, 2008-03-06: Need to rename datejoined and dateexpires to
# match their db names.
datejoined = UtcDateTimeCol(dbName='date_joined', default=None)