launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #24615
[Merge] ~cjwatson/launchpad:fix-translation-sharing-job-derived into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:fix-translation-sharing-job-derived into launchpad:master.
Commit message:
Regularise TranslationSharingJobDerived slightly
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/382817
This makes it a little more like other job classes, and in particular arranges that .job.id on its subclasses that implement IRunnableJob will refer to the ID of a Job table and not something else.
The slightly dodgy old approach broke after upgrading to current ZTK dependencies.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:fix-translation-sharing-job-derived into launchpad:master.
diff --git a/lib/lp/translations/interfaces/translationsharingjob.py b/lib/lp/translations/interfaces/translationsharingjob.py
index 7989eb6..82478d6 100644
--- a/lib/lp/translations/interfaces/translationsharingjob.py
+++ b/lib/lp/translations/interfaces/translationsharingjob.py
@@ -3,6 +3,7 @@
__metaclass__ = type
+from lazr.restful.fields import Reference
from zope.interface import Attribute
from lp import _
@@ -11,6 +12,10 @@ from lp.services.job.interfaces.job import IJob
class ITranslationSharingJob(IJob):
+ job = Reference(
+ title=_("The common Job attributes."), schema=IJob,
+ required=True, readonly=True)
+
productseries = Attribute(_("The productseries of the Packaging."))
distroseries = Attribute(_("The distroseries of the Packaging."))
diff --git a/lib/lp/translations/model/translationsharingjob.py b/lib/lp/translations/model/translationsharingjob.py
index e09a95e..80cdad4 100644
--- a/lib/lp/translations/model/translationsharingjob.py
+++ b/lib/lp/translations/model/translationsharingjob.py
@@ -113,7 +113,7 @@ class TranslationSharingJob(StormBase):
return TranslationSharingJobDerived.makeSubclass(self)
-@delegate_to(ITranslationSharingJob, context='job')
+@delegate_to(ITranslationSharingJob)
class TranslationSharingJobDerived:
"""Base class for specialized TranslationTemplate Job types."""
@@ -143,7 +143,7 @@ class TranslationSharingJobDerived:
assert job.job_type == self.class_job_type, (
"Attempting to create a %s using a %s TranslationSharingJob" %
(self.__class__.__name__, job.job_type))
- self.job = job
+ self.context = job
@classmethod
def create(cls, productseries=None, distroseries=None,
Follow ups