~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-06-25 08:55:37 UTC
  • mfrom: (13287.1.8 bug-800652)
  • Revision ID: launchpad@pqm.canonical.com-20110625085537-moikyoo2pe98zs7r
[r=jcsackett, julian-edwards][bug=800634,
        800652] Enable and display overrides on sync package uploads.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
from lazr.restful.declarations import (
19
19
    call_with,
20
20
    export_as_webservice_entry,
 
21
    exported,
21
22
    export_write_operation,
22
 
    exported,
23
23
    operation_for_version,
24
24
    operation_parameters,
25
25
    REQUEST_USER,
29
29
    Reference,
30
30
    ReferenceChoice,
31
31
    )
 
32
 
32
33
from zope.interface import (
33
34
    Attribute,
34
35
    Interface,
43
44
    TextLine,
44
45
    )
45
46
 
46
 
from lp import _
 
47
from canonical.launchpad import _
 
48
from lp.answers.interfaces.faq import IFAQ
47
49
from lp.answers.enums import (
48
50
    QuestionPriority,
49
51
    QuestionStatus,
50
52
    )
51
 
from lp.answers.interfaces.faq import IFAQ
52
53
from lp.answers.interfaces.questionmessage import IQuestionMessage
53
54
from lp.answers.interfaces.questiontarget import IQuestionTarget
54
 
from lp.registry.interfaces.person import IPerson
55
55
from lp.registry.interfaces.role import IHasOwner
56
56
from lp.services.fields import PublicPersonChoice
57
57
from lp.services.worlddata.interfaces.language import ILanguage
156
156
        description=_('Up-to-date notes on the status of the question.'))
157
157
    # other attributes
158
158
    target = exported(Reference(
159
 
        title=_('This question is about'), required=True,
160
 
        schema=IQuestionTarget,
161
 
        description=_('The distribution, source package, or project the '
 
159
        title=_('Project'), required=True, schema=IQuestionTarget,
 
160
        description=_('The distribution, source package, or product the '
162
161
                      'question pertains to.')),
163
162
        as_of="devel")
164
163
    faq = Object(
435
434
        """
436
435
 
437
436
    # subscription-related methods
438
 
 
439
 
    @operation_parameters(
440
 
        person=Reference(IPerson, title=_('Person'), required=True))
441
 
    @call_with(subscribed_by=REQUEST_USER)
442
 
    @export_write_operation()
443
 
    @operation_for_version("devel")
444
 
    def subscribe(person, subscribed_by=None):
445
 
        """Subscribe `person` to the question.
446
 
 
447
 
        :param person: the subscriber.
448
 
        :param subscribed_by: the person who created the subscription.
449
 
        :return: an `IQuestionSubscription`.
450
 
        """
 
437
    def subscribe(person):
 
438
        """Subscribe this person to the question."""
451
439
 
452
440
    def isSubscribed(person):
453
441
        """Return a boolean indicating whether the person is subscribed."""
454
442
 
455
 
    @operation_parameters(
456
 
        person=Reference(IPerson, title=_('Person'), required=False))
457
 
    @call_with(unsubscribed_by=REQUEST_USER)
458
 
    @export_write_operation()
459
 
    @operation_for_version("devel")
460
 
    def unsubscribe(person, unsubscribed_by):
461
 
        """Unsubscribe `person` from the question.
462
 
 
463
 
        :param person: the subscriber.
464
 
        :param unsubscribed_by: the person who removed the subscription.
465
 
        """
 
443
    def unsubscribe(person):
 
444
        """Remove the person's subscription to this question."""
466
445
 
467
446
    def getDirectSubscribers():
468
447
        """Return the persons who are subscribed to this question.
470
449
        :return: A list of persons sorted by displayname.
471
450
        """
472
451
 
473
 
    def getDirectSubscribersWithDetails():
474
 
        """Get direct subscribers and their subscriptions for the question.
475
 
 
476
 
        :returns: A ResultSet of tuples (Person, QuestionSubscription)
477
 
            representing a subscriber and their question subscription.
478
 
        """
479
 
 
480
452
    def getIndirectSubscribers():
481
453
        """Return the persons who are implicitly subscribed to this question.
482
454