File: root.py

package info (click to toggle)
python-wikkid 0.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 728 kB
  • sloc: python: 3,051; makefile: 12
file content (43 lines) | stat: -rw-r--r-- 1,120 bytes parent folder | download | duplicates (2)
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
#
# Copyright (C) 2010 Wikkid Developers.
#
# This software is licensed under the GNU Affero General Public License
# version 3 (see the file LICENSE).

"""The root resource class.

The root resource represents the object at the root of the wiki path.

Currently this just refers to '/', but it is expected that at some stage in
the not too distant future the server will support a wiki root where it is not
the root path.
"""

from zope.interface import implementer

from wikkid.model.directory import DirectoryResource
from wikkid.interface.resource import IRootResource


@implementer(IRootResource)
class RootResource(DirectoryResource):
    """The root of the wiki.

    Some special wiki views hang off the root resource and not others.  A root
    resource is also a directory resource where the directory is the root of
    the filesystem.
    """

    def get_dir_name(self):
        return None

    @property
    def has_home_page(self):
        return self.file_resource is not None

    def __repr__(self):
        return "<RootResource '/'>"

    @property
    def preferred_path(self):
        return '/'