~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/vostok/browser/root.py

  • Committer: Julian Edwards
  • Date: 2011-07-28 20:46:18 UTC
  • mfrom: (13553 devel)
  • mto: This revision was merged to the branch mainline in revision 13555.
  • Revision ID: julian.edwards@canonical.com-20110728204618-tivj2wx2oa9s32bx
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright 2010 Canonical Ltd.  This software is licensed under the
 
2
# GNU Affero General Public License version 3 (see the file LICENSE).
 
3
 
 
4
"""Browser code for the Vostok root."""
 
5
 
 
6
__metaclass__ = type
 
7
__all__ = [
 
8
    'VostokRootView',
 
9
    'VostokLayerToMainTemplateAdapter',
 
10
    ]
 
11
 
 
12
import os
 
13
 
 
14
from zope.component import (
 
15
    adapts,
 
16
    getUtility,
 
17
    )
 
18
from zope.interface import implements
 
19
 
 
20
from canonical.launchpad.webapp import LaunchpadView
 
21
from lp.app.browser.tales import IMainTemplateFile
 
22
from lp.registry.interfaces.distribution import IDistributionSet
 
23
from lp.vostok.publisher import VostokLayer
 
24
 
 
25
 
 
26
class VostokRootView(LaunchpadView):
 
27
    """The view for the Vostok root object."""
 
28
 
 
29
    page_title = 'Vostok'
 
30
 
 
31
    @property
 
32
    def distributions(self):
 
33
        """An iterable of all registered distributions."""
 
34
        return getUtility(IDistributionSet)
 
35
 
 
36
 
 
37
class VostokLayerToMainTemplateAdapter:
 
38
    adapts(VostokLayer)
 
39
    implements(IMainTemplateFile)
 
40
 
 
41
    def __init__(self, context):
 
42
        here = os.path.dirname(os.path.realpath(__file__))
 
43
        self.path = os.path.join(here, '../templates/main-template.pt')