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
69
70
71
72
73
74
|
# 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
"""Source package name interfaces."""
__metaclass__ = type
__all__ = [
'ISourcePackageName',
'ISourcePackageNameSet',
]
from zope.interface import (
Attribute,
Interface,
)
from zope.schema import (
Int,
TextLine,
)
from canonical.launchpad import _
from lp.app.validators.name import name_validator
class ISourcePackageName(Interface):
"""Interface provied by a SourcePackageName.
This is a tiny table that allows multiple SourcePackage entities to share
a single name.
"""
id = Int(title=_("ID"), required=True)
name = TextLine(title=_("Valid Source package name"),
required=True, constraint=name_validator)
potemplates = Attribute("The list of PO templates that this object has.")
packagings = Attribute("Everything we know about the packaging of "
"packages with this source package name.")
def __unicode__():
"""Return the name"""
class ISourcePackageNameSet(Interface):
"""A set of SourcePackageName."""
def __getitem__(name):
"""Retrieve a sourcepackagename by name."""
def get(sourcepackagenameid):
"""Return a sourcepackagename by its id.
If the sourcepackagename can't be found a NotFoundError will be
raised.
"""
def getAll():
"""return an iselectresults representing all package names"""
def findByName(name):
"""Find sourcepackagenames by its name or part of it"""
def queryByName(name):
"""Get a sourcepackagename by its name atttribute.
Returns the matching ISourcePackageName or None.
"""
def new(name):
"""Create a new source package name."""
def getOrCreateByName(name):
"""Get a source package name by name, creating it if necessary."""
|