summaryrefslogtreecommitdiff
path: root/controller.py
blob: 69eaf769f1d4634a31cc3d3fdadb21d6c5e409ee (plain)
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
from __future__ import with_statement

import web
from helper import appdir
from renderer import render

class Show:
    def GET(self, year = '', month = ''):
        if year: return "Show %s/%s" % (year, month)
        else: return "Show current"

class Add:
    def GET(self):
        return "Add new"

class Edit:
    def GET(self, id):
        return "Edit " + id

class Const:
    def GET(self):
        return "Const"

class ConstAdd:
    def GET(self):
        return "Add new const"

class ConstEdit:
    def GET(self, id):
        return "Const Edit " + id

class Cat:
    def GET(self, id = '/'):
        if id:
            id = id[1:]

        if not id: return "Add new cat"
        else: return "Edit cat " + id

class FourOhFour:
    """
    404 error page.
    """

    def GET (self, p):
        raise self.catch(p)

    @staticmethod
    def catch (page = "?"):
        return web.notfound(render("404", page = page))