1 |
dpavlin |
1 |
from subway.view import views |
2 |
|
|
from subway import controller, util |
3 |
|
|
from cherrypy import cpg |
4 |
|
|
|
5 |
|
|
from HyperEstraier import * |
6 |
|
|
|
7 |
|
|
views = views |
8 |
|
|
|
9 |
|
|
class Root(controller.Controller): |
10 |
|
|
def index(self): |
11 |
|
|
return views.index() |
12 |
|
|
index.exposed = True |
13 |
|
|
|
14 |
|
|
def search(self, keyword=""): |
15 |
|
|
cond = Condition() |
16 |
|
|
cond.set_phrase(keyword) |
17 |
|
|
cond.set_order('@mdate STRD') |
18 |
|
|
numbers = self.db.search(cond, 0) |
19 |
|
|
return views.search(db = self.db, numbers=numbers) |
20 |
|
|
search.exposed = True |
21 |
|
|
|
22 |
|
|
def mail(self, id=""): |
23 |
|
|
return views.mail(doc=self.db.get_doc(int(id), 0)) |
24 |
|
|
mail.exposed = True |
25 |
|
|
|
26 |
|
|
def __init__(self): |
27 |
|
|
self.db = Database() |
28 |
|
|
if not self.db.open('/tmp/casket', Database.DBREADER): |
29 |
|
|
raise "cannot open db" |
30 |
|
|
|
31 |
|
|
controller = Root() |