Merge ~cjwatson/launchpad:fix-translation-sharing-job-derived into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: 0db013efabae44f13d219e69bc74f025bd82c9ed
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:fix-translation-sharing-job-derived
Merge into: launchpad:master
Diff against target: 45 lines (+7/-2)
2 files modified
lib/lp/translations/interfaces/translationsharingjob.py (+5/-0)
lib/lp/translations/model/translationsharingjob.py (+2/-2)
Reviewer Review Type Date Requested Status
Tom Wardill (community) Approve
Review via email: mp+382817@code.launchpad.net

Commit message

Regularise TranslationSharingJobDerived slightly

Description of the change

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.

I ran into trouble with the slightly dodgy old approach while trying to fix BaseRunnableJob to work with transaction 3.0.0.

To post a comment you must log in.
Revision history for this message
Tom Wardill (twom) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
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 @@
33
4__metaclass__ = type4__metaclass__ = type
55
6from lazr.restful.fields import Reference
6from zope.interface import Attribute7from zope.interface import Attribute
78
8from lp import _9from lp import _
@@ -11,6 +12,10 @@ from lp.services.job.interfaces.job import IJob
1112
12class ITranslationSharingJob(IJob):13class ITranslationSharingJob(IJob):
1314
15 job = Reference(
16 title=_("The common Job attributes."), schema=IJob,
17 required=True, readonly=True)
18
14 productseries = Attribute(_("The productseries of the Packaging."))19 productseries = Attribute(_("The productseries of the Packaging."))
1520
16 distroseries = Attribute(_("The distroseries of the Packaging."))21 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):
113 return TranslationSharingJobDerived.makeSubclass(self)113 return TranslationSharingJobDerived.makeSubclass(self)
114114
115115
116@delegate_to(ITranslationSharingJob, context='job')116@delegate_to(ITranslationSharingJob)
117class TranslationSharingJobDerived:117class TranslationSharingJobDerived:
118 """Base class for specialized TranslationTemplate Job types."""118 """Base class for specialized TranslationTemplate Job types."""
119119
@@ -143,7 +143,7 @@ class TranslationSharingJobDerived:
143 assert job.job_type == self.class_job_type, (143 assert job.job_type == self.class_job_type, (
144 "Attempting to create a %s using a %s TranslationSharingJob" %144 "Attempting to create a %s using a %s TranslationSharingJob" %
145 (self.__class__.__name__, job.job_type))145 (self.__class__.__name__, job.job_type))
146 self.job = job146 self.context = job
147147
148 @classmethod148 @classmethod
149 def create(cls, productseries=None, distroseries=None,149 def create(cls, productseries=None, distroseries=None,

Subscribers

People subscribed via source and target branches

to status/vote changes: