launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #27743
[Merge] ~cjwatson/launchpad:translations-dbenum into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:translations-dbenum into launchpad:master.
Commit message:
lp.translations: 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/412098
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:translations-dbenum into launchpad:master.
diff --git a/lib/lp/translations/model/potemplate.py b/lib/lp/translations/model/potemplate.py
index 45f6a99..d9b92ad 100644
--- a/lib/lp/translations/model/potemplate.py
+++ b/lib/lp/translations/model/potemplate.py
@@ -47,7 +47,7 @@ from lp.services.database.collection import Collection
from lp.services.database.constants import DEFAULT
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,
@@ -214,9 +214,10 @@ class POTemplate(SQLBase, RosettaStats):
path = StringCol(dbName='path', notNull=True)
source_file = ForeignKey(foreignKey='LibraryFileAlias',
dbName='source_file', notNull=False, default=None)
- source_file_format = EnumCol(dbName='source_file_format',
- schema=TranslationFileFormat, default=TranslationFileFormat.PO,
- notNull=True)
+ source_file_format = DBEnum(
+ name='source_file_format',
+ enum=TranslationFileFormat, default=TranslationFileFormat.PO,
+ allow_none=False)
iscurrent = BoolCol(dbName='iscurrent', notNull=True, default=True)
messagecount = IntCol(dbName='messagecount', notNull=True, default=0)
owner = ForeignKey(
diff --git a/lib/lp/translations/model/translationmessage.py b/lib/lp/translations/model/translationmessage.py
index 564cfa8..f07e088 100644
--- a/lib/lp/translations/model/translationmessage.py
+++ b/lib/lp/translations/model/translationmessage.py
@@ -36,7 +36,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 (
quote,
@@ -281,11 +281,11 @@ class TranslationMessage(SQLBase, TranslationMessageMixIn):
comment = StringCol(
dbName='comment', notNull=False, default=None)
- origin = EnumCol(
- dbName='origin', notNull=True, schema=RosettaTranslationOrigin)
- validation_status = EnumCol(
- dbName='validation_status', notNull=True,
- schema=TranslationValidationStatus)
+ origin = DBEnum(
+ name='origin', allow_none=False, enum=RosettaTranslationOrigin)
+ validation_status = DBEnum(
+ name='validation_status', allow_none=False,
+ enum=TranslationValidationStatus)
is_current_ubuntu = BoolCol(
dbName='is_current_ubuntu', notNull=True, default=False)
is_current_upstream = BoolCol(
diff --git a/lib/lp/translations/model/translationsharingjob.py b/lib/lp/translations/model/translationsharingjob.py
index 24c9762..bd3b402 100644
--- a/lib/lp/translations/model/translationsharingjob.py
+++ b/lib/lp/translations/model/translationsharingjob.py
@@ -23,7 +23,7 @@ from storm.locals import (
from lp.registry.model.distroseries import DistroSeries
from lp.registry.model.productseries import ProductSeries
from lp.registry.model.sourcepackagename import SourcePackageName
-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.interfaces.job import (
@@ -74,7 +74,7 @@ class TranslationSharingJob(StormBase):
job = Reference(job_id, Job.id)
- job_type = EnumCol(enum=TranslationSharingJobType, notNull=True)
+ job_type = DBEnum(enum=TranslationSharingJobType, allow_none=False)
productseries_id = Int('productseries')