1
# Copyright 2011 Canonical Ltd. This software is licensed under the
2
# GNU Affero General Public License version 3 (see the file LICENSE).
4
"""Interface for the Jobs system for questions."""
10
'IQuestionEmailJobSource',
13
from zope.interface import Attribute
14
from zope.schema import (
21
from canonical.launchpad import _
22
from lp.answers.enums import QuestionJobType
23
from lp.services.job.interfaces.job import (
30
class IQuestionJob(IRunnableJob):
31
"""A Job related to a question."""
34
title=_('DB ID'), required=True, readonly=True,
35
description=_("The tracking number for this job."))
38
title=_('The common Job attributes'),
39
schema=IJob, required=True)
42
title=_('Job type'), vocabulary=QuestionJobType,
43
required=True, readonly=True)
46
title=_("The question related to this job."),
47
description=_("An IQuestion."), required=True, readonly=True)
49
metadata = Attribute('A dict of data about the job.')
52
class IQuestionEmailJob(IQuestionJob):
54
user = Attribute('The `IPerson` who triggered the email.')
56
subject = Attribute('The subject of the email.')
59
'The body of the email that is common to all recpients.')
62
'The headers of the email that are common to all recpients.')
65
class IQuestionEmailJobSource(IJobSource):
66
"""An interface for acquiring IQuestionJob."""
68
def create(question, user, subject, body, headers):
69
"""Create a new IQuestionJob.
71
:param question: An `IQuestion`.
72
:param user: An `IPerson`.
73
:param subject: A'The subject of the email.
74
:param body: The text of the email that is common to all recpients.
75
:parma headers: A dict of headers for the email that are common to