code factorization
This commit is contained in:
parent
8ece426999
commit
9c923da16a
1 changed files with 5 additions and 9 deletions
|
|
@ -37,20 +37,17 @@ class Application(BaseApplication):
|
||||||
def main(self, argv):
|
def main(self, argv):
|
||||||
self.weboob.load_modules()
|
self.weboob.load_modules()
|
||||||
|
|
||||||
|
template_lookup = TemplateLookup(directories=['%s/../templates' % os.path.dirname(__file__)],
|
||||||
|
output_encoding='utf-8', encoding_errors='replace')
|
||||||
|
|
||||||
@wee.get('/')
|
@wee.get('/')
|
||||||
def index(request):
|
def index(request):
|
||||||
script_path = os.path.dirname(__file__)
|
template = template_lookup.get_template('index.mako')
|
||||||
lookup = TemplateLookup(directories=['%s/../templates' % script_path],
|
|
||||||
output_encoding='utf-8', encoding_errors='replace')
|
|
||||||
template = lookup.get_template('index.mako')
|
|
||||||
return template.render().strip()
|
return template.render().strip()
|
||||||
|
|
||||||
@wee.get('/messages')
|
@wee.get('/messages')
|
||||||
def messages(request):
|
def messages(request):
|
||||||
script_path = os.path.dirname(__file__)
|
template = template_lookup.get_template('messages.mako')
|
||||||
lookup = TemplateLookup(directories=['%s/../templates' % script_path],
|
|
||||||
output_encoding='utf-8', encoding_errors='replace')
|
|
||||||
template = lookup.get_template('messages.mako')
|
|
||||||
backends = list(app.weboob.iter_backends(ICapMessages))
|
backends = list(app.weboob.iter_backends(ICapMessages))
|
||||||
return template.render(backends=backends).strip()
|
return template.render(backends=backends).strip()
|
||||||
|
|
||||||
|
|
@ -59,4 +56,3 @@ if __name__ == '__main__':
|
||||||
app.main(sys.argv)
|
app.main(sys.argv)
|
||||||
srv = make_server('localhost', 8080, wee.make_app())
|
srv = make_server('localhost', 8080, wee.make_app())
|
||||||
srv.serve_forever()
|
srv.serve_forever()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue