~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/blueprints/interfaces/specification.py

[r=benji][bug=50875] Allow teams to be unsubscribed from blueprints
        and fix (modernise) form infrastructure.

Show diffs side-by-side

added added

removed removed

Lines of Context:
55
55
    SpecificationLifecycleStatus,
56
56
    SpecificationPriority,
57
57
    )
 
58
from lp.blueprints.interfaces.specificationsubscription import (
 
59
    ISpecificationSubscription,
 
60
    )
58
61
from lp.blueprints.interfaces.specificationtarget import (
59
62
    IHasSpecifications,
60
63
    ISpecificationTarget,
63
66
from lp.bugs.interfaces.buglink import IBugLinkTarget
64
67
from lp.code.interfaces.branchlink import IHasLinkedBranches
65
68
from lp.registry.interfaces.milestone import IMilestone
 
69
from lp.registry.interfaces.person import IPerson
66
70
from lp.registry.interfaces.projectgroup import IProjectGroup
67
71
from lp.registry.interfaces.role import IHasOwner
68
72
from lp.services.fields import (
467
471
    def subscription(person):
468
472
        """Return the subscription for this person to this spec, or None."""
469
473
 
470
 
    def subscribe(person, essential=False):
 
474
    @operation_parameters(
 
475
        person=Reference(IPerson, title=_('Person'), required=True),
 
476
        essential=copy_field(
 
477
            ISpecificationSubscription['essential'], required=False))
 
478
    @call_with(subscribed_by=REQUEST_USER)
 
479
    @export_write_operation()
 
480
    @operation_for_version('devel')
 
481
    def subscribe(person, subscribed_by=None, essential=False):
471
482
        """Subscribe this person to the feature specification."""
472
483
 
473
 
    def unsubscribe(person):
 
484
    @operation_parameters(
 
485
        person=Reference(IPerson, title=_('Person'), required=False))
 
486
    @call_with(unsubscribed_by=REQUEST_USER)
 
487
    @export_write_operation()
 
488
    @operation_for_version('devel')
 
489
    def unsubscribe(person, unsubscribed_by):
474
490
        """Remove the person's subscription to this spec."""
475
491
 
476
492
    def getSubscriptionByName(name):