launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #27738
[Merge] ~cjwatson/launchpad:code-dbenum into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:code-dbenum into launchpad:master.
Commit message:
lp.code: 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/412073
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:code-dbenum into launchpad:master.
diff --git a/lib/lp/code/model/branch.py b/lib/lp/code/model/branch.py
index 6a1e70e..c2a0de5 100644
--- a/lib/lp/code/model/branch.py
+++ b/lib/lp/code/model/branch.py
@@ -164,7 +164,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 (
IMasterStore,
IStore,
@@ -206,19 +206,19 @@ class Branch(SQLBase, WebhookTargetMixin, BzrIdentityMixin):
"""A sequence of ordered revisions in Bazaar."""
_table = 'Branch'
- branch_type = EnumCol(enum=BranchType, notNull=True)
+ branch_type = DBEnum(enum=BranchType, allow_none=False)
name = StringCol(notNull=False)
url = StringCol(dbName='url')
description = StringCol(dbName='summary')
- branch_format = EnumCol(enum=BranchFormat)
- repository_format = EnumCol(enum=RepositoryFormat)
+ branch_format = DBEnum(enum=BranchFormat)
+ repository_format = DBEnum(enum=RepositoryFormat)
# XXX: Aaron Bentley 2008-06-13
# Rename the metadir_format in the database, see bug 239746
- control_format = EnumCol(enum=ControlFormat, dbName='metadir_format')
+ control_format = DBEnum(enum=ControlFormat, name='metadir_format')
whiteboard = StringCol(default=None)
mirror_status_message = StringCol(default=None)
- information_type = EnumCol(
+ information_type = DBEnum(
enum=InformationType, default=InformationType.PUBLIC)
@property
@@ -334,8 +334,8 @@ class Branch(SQLBase, WebhookTargetMixin, BzrIdentityMixin):
dbName='sourcepackagename', foreignKey='SourcePackageName',
default=None)
- lifecycle_status = EnumCol(
- enum=BranchLifecycleStatus, notNull=True,
+ lifecycle_status = DBEnum(
+ enum=BranchLifecycleStatus, allow_none=False,
default=BranchLifecycleStatus.DEVELOPMENT)
last_mirrored = UtcDateTimeCol(default=None)
diff --git a/lib/lp/code/model/branchmergeproposal.py b/lib/lp/code/model/branchmergeproposal.py
index c3d0c4d..bb4d009 100644
--- a/lib/lp/code/model/branchmergeproposal.py
+++ b/lib/lp/code/model/branchmergeproposal.py
@@ -108,7 +108,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 (
IMasterStore,
IStore,
@@ -321,8 +321,8 @@ class BranchMergeProposal(SQLBase, BugLinkTargetMixin):
whiteboard = StringCol(default=None)
- queue_status = EnumCol(
- enum=BranchMergeProposalStatus, notNull=True,
+ queue_status = DBEnum(
+ enum=BranchMergeProposalStatus, allow_none=False,
default=BranchMergeProposalStatus.WORK_IN_PROGRESS)
@property
diff --git a/lib/lp/code/model/branchmergeproposaljob.py b/lib/lp/code/model/branchmergeproposaljob.py
index 486fd15..3a58ae9 100644
--- a/lib/lp/code/model/branchmergeproposaljob.py
+++ b/lib/lp/code/model/branchmergeproposaljob.py
@@ -82,7 +82,7 @@ from lp.codehosting.bzrutils import server
from lp.codehosting.vfs import get_ro_server
from lp.registry.interfaces.person import IPersonSet
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,
@@ -159,7 +159,7 @@ class BranchMergeProposalJob(StormBase):
branch_merge_proposal = Reference(
branch_merge_proposalID, BranchMergeProposal.id)
- job_type = EnumCol(enum=BranchMergeProposalJobType, notNull=True)
+ job_type = DBEnum(enum=BranchMergeProposalJobType, allow_none=False)
_json_data = Unicode('json_data')
diff --git a/lib/lp/code/model/gitactivity.py b/lib/lp/code/model/gitactivity.py
index 7fe0dee..a7b2036 100644
--- a/lib/lp/code/model/gitactivity.py
+++ b/lib/lp/code/model/gitactivity.py
@@ -26,7 +26,7 @@ from lp.registry.interfaces.person import (
validate_public_person,
)
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.stormbase import StormBase
@@ -52,8 +52,8 @@ class GitActivity(StormBase):
name='changee', allow_none=True, validator=validate_person)
changee = Reference(changee_id, 'Person.id')
- what_changed = EnumCol(
- dbName='what_changed', enum=GitActivityType, notNull=True)
+ what_changed = DBEnum(
+ name='what_changed', enum=GitActivityType, allow_none=False)
old_value = JSON(name='old_value', allow_none=True)
new_value = JSON(name='new_value', allow_none=True)
diff --git a/lib/lp/code/model/gitjob.py b/lib/lp/code/model/gitjob.py
index 347d2f1..2e78d06 100644
--- a/lib/lp/code/model/gitjob.py
+++ b/lib/lp/code/model/gitjob.py
@@ -49,7 +49,7 @@ from lp.code.interfaces.gitrule import describe_git_permissions
from lp.code.mail.branch import BranchMailer
from lp.registry.interfaces.person import IPersonSet
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,
@@ -110,7 +110,7 @@ class GitJob(StormBase):
repository_id = Int(name='repository', allow_none=True)
repository = Reference(repository_id, 'GitRepository.id')
- job_type = EnumCol(enum=GitJobType, notNull=True)
+ job_type = DBEnum(enum=GitJobType, allow_none=False)
metadata = JSON('json_data')
diff --git a/lib/lp/code/model/gitref.py b/lib/lp/code/model/gitref.py
index 7358336..41af46a 100644
--- a/lib/lp/code/model/gitref.py
+++ b/lib/lp/code/model/gitref.py
@@ -79,7 +79,7 @@ from lp.code.model.gitrule import (
from lp.services.config import config
from lp.services.database.constants import UTC_NOW
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.stormbase import StormBase
from lp.services.features import getFeatureFlag
@@ -510,7 +510,7 @@ class GitRef(GitRefMixin, StormBase):
commit_sha1 = Unicode(name='commit_sha1', allow_none=False)
- object_type = EnumCol(enum=GitObjectType, notNull=True)
+ object_type = DBEnum(enum=GitObjectType, allow_none=False)
author_id = Int(name='author', allow_none=True)
author = Reference(author_id, 'RevisionAuthor.id')
diff --git a/lib/lp/code/model/gitrepository.py b/lib/lp/code/model/gitrepository.py
index 796ab80..7210ec4 100644
--- a/lib/lp/code/model/gitrepository.py
+++ b/lib/lp/code/model/gitrepository.py
@@ -187,7 +187,7 @@ from lp.services.database.constants import (
UTC_NOW,
)
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 get_transaction_timestamp
from lp.services.database.stormbase import StormBase
@@ -306,11 +306,11 @@ class GitRepository(StormBase, WebhookTargetMixin, AccessTokenTargetMixin,
date_last_modified = DateTime(
name='date_last_modified', tzinfo=pytz.UTC, allow_none=False)
- repository_type = EnumCol(
- dbName='repository_type', enum=GitRepositoryType, notNull=True)
+ repository_type = DBEnum(
+ name='repository_type', enum=GitRepositoryType, allow_none=False)
- status = EnumCol(
- dbName='status', enum=GitRepositoryStatus, notNull=True,
+ status = DBEnum(
+ name='status', enum=GitRepositoryStatus, allow_none=False,
default=GitRepositoryStatus.AVAILABLE)
registrant_id = Int(name='registrant', allow_none=False)
@@ -338,7 +338,7 @@ class GitRepository(StormBase, WebhookTargetMixin, AccessTokenTargetMixin,
description = Unicode(name='description', allow_none=True)
- information_type = EnumCol(enum=InformationType, notNull=True)
+ information_type = DBEnum(enum=InformationType, allow_none=False)
owner_default = Bool(name='owner_default', allow_none=False)
target_default = Bool(name='target_default', allow_none=False)
diff --git a/lib/lp/code/model/gitsubscription.py b/lib/lp/code/model/gitsubscription.py
index a1d2b49..8ad435a 100644
--- a/lib/lp/code/model/gitsubscription.py
+++ b/lib/lp/code/model/gitsubscription.py
@@ -21,7 +21,7 @@ from lp.code.security import GitSubscriptionEdit
from lp.registry.interfaces.person import validate_person
from lp.registry.interfaces.role import IPersonRoles
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.stormbase import StormBase
@@ -39,13 +39,13 @@ class GitSubscription(StormBase):
repository_id = Int(name='repository', allow_none=False)
repository = Reference(repository_id, 'GitRepository.id')
- notification_level = EnumCol(
- enum=BranchSubscriptionNotificationLevel, notNull=True,
+ notification_level = DBEnum(
+ enum=BranchSubscriptionNotificationLevel, allow_none=False,
default=DEFAULT)
- max_diff_lines = EnumCol(
- enum=BranchSubscriptionDiffSize, notNull=False, default=DEFAULT)
- review_level = EnumCol(
- enum=CodeReviewNotificationLevel, notNull=True, default=DEFAULT)
+ max_diff_lines = DBEnum(
+ enum=BranchSubscriptionDiffSize, allow_none=True, default=DEFAULT)
+ review_level = DBEnum(
+ enum=CodeReviewNotificationLevel, allow_none=False, default=DEFAULT)
subscribed_by_id = Int(
name='subscribed_by', allow_none=False, validator=validate_person)
diff --git a/lib/lp/code/model/sourcepackagerecipedata.py b/lib/lp/code/model/sourcepackagerecipedata.py
index c67fbf0..f5d849b 100644
--- a/lib/lp/code/model/sourcepackagerecipedata.py
+++ b/lib/lp/code/model/sourcepackagerecipedata.py
@@ -69,7 +69,7 @@ from lp.services.database.bulk import (
load_referencing,
load_related,
)
-from lp.services.database.enumcol import EnumCol
+from lp.services.database.enumcol import DBEnum
from lp.services.database.interfaces import IStore
from lp.services.propertycache import (
cachedproperty,
@@ -134,7 +134,7 @@ class _SourcePackageRecipeDataInstruction(Storm):
id = Int(primary=True)
name = Unicode(allow_none=False)
- type = EnumCol(notNull=True, schema=InstructionType)
+ type = DBEnum(allow_none=False, enum=InstructionType)
comment = Unicode(allow_none=True)
line_number = Int(allow_none=False)