summaryrefslogtreecommitdiff
path: root/controller.py
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2010-05-04 12:36:58 +0200
committerRené 'Necoro' Neumann <necoro@necoro.net>2010-05-04 12:36:58 +0200
commit4b4905db5f4123a88dca9f0164a3a35679a9dc13 (patch)
treeea27faa54edb1fa2b00b713bd42229e9a9d51e34 /controller.py
parent5e319a2c641e67594000afdef477ac96e6283fa6 (diff)
downloadkosten-4b4905db5f4123a88dca9f0164a3a35679a9dc13.tar.gz
kosten-4b4905db5f4123a88dca9f0164a3a35679a9dc13.tar.bz2
kosten-4b4905db5f4123a88dca9f0164a3a35679a9dc13.zip
More controller stuff
Diffstat (limited to 'controller.py')
-rw-r--r--controller.py49
1 files changed, 40 insertions, 9 deletions
diff --git a/controller.py b/controller.py
index e4c07f7..69eaf76 100644
--- a/controller.py
+++ b/controller.py
@@ -4,16 +4,47 @@ import web
from helper import appdir
from renderer import render
-class Page:
- """
- All the general and simple pages.
- """
- def GET(self, name = '/'):
- if not name or name == '/': name = 'index'
- return render(name)
+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"
-def FourOhFour(page="?"):
+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.
"""
- return web.notfound(render("404", level = "", page = page))
+
+ def GET (self, p):
+ raise self.catch(p)
+
+ @staticmethod
+ def catch (page = "?"):
+ return web.notfound(render("404", page = page))