1
# Copyright 2009 Canonical Ltd. This software is licensed under the
2
# GNU Affero General Public License version 3 (see the file LICENSE).
4
# pylint: disable-msg=E0211,E0213
6
"""Interfaces for linking Specifications and Branches."""
11
"ISpecificationBranch",
12
"ISpecificationBranchSet",
15
from lazr.restful.declarations import (
16
export_as_webservice_entry,
18
export_write_operation,
20
operation_for_version,
22
from lazr.restful.fields import (
26
from zope.interface import Interface
27
from zope.schema import Int
29
from canonical.launchpad import _
30
from lp.app.interfaces.launchpad import IHasDateCreated
31
from lp.blueprints.interfaces.specification import ISpecification
32
from lp.code.interfaces.branch import IBranch
33
from lp.registry.interfaces.person import IPerson
36
class ISpecificationBranch(IHasDateCreated):
37
"""A branch linked to a specification."""
39
export_as_webservice_entry(as_of="beta")
41
id = Int(title=_("Specification Branch #"))
42
specification = exported(
44
title=_("Blueprint"), vocabulary="Specification",
46
readonly=True, schema=ISpecification), as_of="beta")
52
schema=IBranch), as_of="beta")
54
registrant = exported(
56
schema=IPerson, readonly=True, required=True,
57
title=_("The person who linked the bug to the branch")),
60
@export_operation_as('delete')
61
@export_write_operation()
62
@operation_for_version('beta')
64
"""Destroy this specification branch link"""
67
class ISpecificationBranchSet(Interface):
68
"""Methods that work on the set of all specification branch links."""
70
def getSpecificationBranchesForBranches(branches, user):
71
"""Return a sequence of ISpecificationBranch instances associated with
74
Only return instances that are visible to the user.