~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/answers/interfaces/question.py

  • Committer: Curtis Hovey
  • Date: 2011-05-14 02:51:04 UTC
  • mto: This revision was merged to the branch mainline in revision 13055.
  • Revision ID: curtis.hovey@canonical.com-20110514025104-k3pvi42kgzimjsxz
Fixed language schema and exported target.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
    operation_parameters,
26
26
    REQUEST_USER,
27
27
    )
28
 
from lazr.restful.fields import ReferenceChoice
 
28
from lazr.restful.fields import (
 
29
    Reference,
 
30
    ReferenceChoice,
 
31
    )
29
32
 
30
33
from zope.interface import (
31
34
    Attribute,
52
55
from lp.answers.interfaces.questiontarget import IQuestionTarget
53
56
from lp.registry.interfaces.role import IHasOwner
54
57
from lp.services.fields import PublicPersonChoice
 
58
from lp.services.worlddata.interfaces.language import ILanguage
55
59
 
56
60
 
57
61
class InvalidQuestionStateError(Exception):
91
95
    # XXX flacoste 2006-10-28: It should be more precise to define a new
92
96
    # vocabulary that excludes the English variants.
93
97
    language = exported(ReferenceChoice(
94
 
        title=_('Language'), vocabulary='Language',
 
98
        title=_('Language'), vocabulary='Language', schema=ILanguage,
95
99
        description=_('The language in which this question is written.')),
96
100
        as_of="devel")
97
101
    owner = exported(PublicPersonChoice(
111
115
        vocabulary='ValidPersonOrTeam'),
112
116
        as_of="devel",
113
117
        readonly=True)
114
 
    # XXX sinzui 2011-05-13: export
115
118
    answer = Object(
116
119
        title=_('Answer'), required=False,
117
120
        description=_("The IQuestionMessage that contains the answer "
118
121
            "confirmed by the owner as providing a solution to his problem."),
119
 
            schema=IQuestionMessage)
 
122
        schema=IQuestionMessage)
120
123
    datecreated = exported(Datetime(
121
124
        title=_('Date Created'), required=True, readonly=True),
122
125
        exported_as='date_created', as_of="devel")
160
163
        title=_('Status Whiteboard'), required=False,
161
164
        description=_('Up-to-date notes on the status of the question.'))
162
165
    # other attributes
163
 
    target = Object(title=_('Project'), required=True, schema=IQuestionTarget,
 
166
    target = exported(Reference(
 
167
        title=_('Project'), required=True, schema=IQuestionTarget,
164
168
        description=_('The distribution, source package, or product the '
165
 
                      'question pertains to.'))
 
169
                      'question pertains to.')),
 
170
        as_of="devel")
166
171
    faq = Object(
167
172
        title=_('Linked FAQ'),
168
173
        description=_('The FAQ document containing the long answer to this '