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
|
# Copyright 2009 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Browser views for source package builds."""
__metaclass__ = type
__all__ = [
'SourcePackageChangelogView',
'SourcePackageCopyrightView',
]
from lazr.restful.utils import smartquote
from zope.component import getUtility
from canonical.launchpad.webapp import (
LaunchpadView,
Navigation,
)
from lp.registry.interfaces.distribution import IDistributionSet
from lp.registry.interfaces.distroseries import IDistroSeriesSet
from lp.registry.interfaces.distroseriesdifference import (
IDistroSeriesDifferenceSource,
)
class SourcePackageChangelogView(LaunchpadView):
"""View class for source package change logs."""
page_title = "Change log"
@property
def label(self):
"""<h1> for the change log page."""
return smartquote("Change logs for " + self.context.title)
class SourcePackageCopyrightView(LaunchpadView):
"""A view to display a source package's copyright information."""
page_title = "Copyright"
@property
def label(self):
"""Page heading."""
return smartquote("Copyright for " + self.context.title)
class SourcePackageDifferenceView(Navigation):
"""A view to traverse to a DistroSeriesDifference.
"""
def traverse(self, parent_distro_name):
parent_distro = getUtility(
IDistributionSet).getByName(parent_distro_name)
parent_series = getUtility(
IDistroSeriesSet).queryByName(
parent_distro, self.request.stepstogo.consume())
dsd_source = getUtility(IDistroSeriesDifferenceSource)
return dsd_source.getByDistroSeriesNameAndParentSeries(
self.context.distroseries, self.context.name, parent_series)
|