1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# Copyright 2009 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
# pylint: disable-msg=E0211,E0213
"""Interfaces for creating a dependency for a given specification. The
dependency is a second specification, so this is really a way of storing the
order in which specs must be implemented. No attempt is made to prevent
circular dependencies at present."""
__metaclass__ = type
__all__ = [
'ISpecificationDependency',
'ISpecificationDependencyRemoval',
'SpecDependencyIsAlsoRemoval',
]
from zope.interface import (
implements,
Interface,
)
from zope.schema import (
Choice,
Int,
)
from lp import _
class ISpecificationDependency(Interface):
"""A link between a specification and another specification on which it
depends.
"""
specification = Int(title=_('Specification ID'), required=True,
readonly=True)
dependency = Choice(title=_('Depends On'), required=True, readonly=True,
vocabulary='SpecificationDepCandidates')
class ISpecificationDependencyRemoval(Interface):
"""A schema that exists purely to define the text and vocabulary for the
specification dependency removal form.
"""
specification = Int(title=_('Specification ID'), required=True,
readonly=True)
dependency = Choice(title=_('Dependency'), required=True, readonly=True,
description=_("Please select the dependency you would like to "
"remove from the list."),
vocabulary='SpecificationDependencies')
class SpecDependencyIsAlsoRemoval:
implements(ISpecificationDependencyRemoval)
def __init__(self, specdep):
self.specdep = specdep
@property
def specification(self):
return self.specdep.specification
@property
def dependency(self):
return self.specdep.dependency
|