diff --git a/web/main.py b/web/main.py index 96827d0..385da61 100755 --- a/web/main.py +++ b/web/main.py @@ -6,7 +6,8 @@ from ml.Search import Search render = web.template.render('templates/') urls=( - '/(.*)','index' + "/","index", + "/news","news" ) app = web.application(urls,globals()) @@ -14,17 +15,23 @@ app = web.application(urls,globals()) class index: def __init__(self): self.se = Search() - def GET(self,searchword): + def GET(self): + searchword = web.input().searchword newslist=list() if searchword: newslist = self.se.QueryPhrase(searchword,False) return render.header(searchword,newslist) - def POST(self): - searchword = web.input(searchword=[]) + +class news: + def __init__(self): + self.se = Search() + def GET(self): + searchword = web.input().searchword + newslist=list() if searchword: newslist = self.se.QueryPhrase(searchword,False) return render.header(searchword,newslist) - + if __name__ == "__main__": app = web.application(urls,globals()) app.run() diff --git a/web/main.pyc b/web/main.pyc index 27195b6..4cfc9b0 100644 Binary files a/web/main.pyc and b/web/main.pyc differ diff --git a/web/templates/header.html b/web/templates/header.html index 311adcf..8a0d569 100644 --- a/web/templates/header.html +++ b/web/templates/header.html @@ -13,11 +13,9 @@ $def with(searchword,newslist)