remove unused http frontend
This commit is contained in:
parent
66fa086574
commit
109fb65f01
5 changed files with 0 additions and 99 deletions
|
|
@ -1,53 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
"""
|
|
||||||
Copyright(C) 2010 Christophe Benz
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, version 3 of the License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
import os
|
|
||||||
|
|
||||||
from mako.lookup import TemplateLookup
|
|
||||||
import wee
|
|
||||||
from wsgiref.simple_server import make_server
|
|
||||||
|
|
||||||
from weboob.capabilities.messages import ICapMessages
|
|
||||||
from weboob.tools.application import BaseApplication
|
|
||||||
|
|
||||||
class HTTPApplication(BaseApplication):
|
|
||||||
APPNAME = 'http'
|
|
||||||
CONFIG = dict(host='localhost', port=8080)
|
|
||||||
|
|
||||||
template_lookup = TemplateLookup(directories=['%s/templates' % os.path.dirname(__file__)],
|
|
||||||
output_encoding='utf-8', encoding_errors='replace')
|
|
||||||
|
|
||||||
|
|
||||||
def main(self, argv):
|
|
||||||
self.load_config()
|
|
||||||
self.weboob.load_backends()
|
|
||||||
self.srv = make_server(self.config.get('host'), self.config.get('port'), wee.make_app())
|
|
||||||
self.srv.serve_forever()
|
|
||||||
|
|
||||||
@wee.get('/')
|
|
||||||
def index(self, request):
|
|
||||||
template = self.template_lookup.get_template('index.mako')
|
|
||||||
return template.render().strip()
|
|
||||||
|
|
||||||
@wee.get('/messages')
|
|
||||||
def messages(self, request):
|
|
||||||
template = self.template_lookup.get_template('messages.mako')
|
|
||||||
backends = list(self.weboob.iter_backends(ICapMessages))
|
|
||||||
return template.render(backends=backends).strip()
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
## -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
<%def name="title()" filter="trim">
|
|
||||||
weboob
|
|
||||||
</%def>
|
|
||||||
|
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>${self.title()}</title>
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
${next.body()}
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
## -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
<%inherit file="base.mako"/>
|
|
||||||
|
|
||||||
<%def name="body()">
|
|
||||||
<ul>
|
|
||||||
<li><a href="/messages">Messages</a>
|
|
||||||
</ul>
|
|
||||||
</%def>
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
## -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
<%inherit file="base.mako"/>
|
|
||||||
|
|
||||||
<%def name="title()" filter="trim">
|
|
||||||
weboob / messages
|
|
||||||
</%def>
|
|
||||||
|
|
||||||
<%def name="body()">
|
|
||||||
% for (name, backend) in backends:
|
|
||||||
<h1>${name}</h1>
|
|
||||||
<ul>
|
|
||||||
% for message in backend.iter_messages():
|
|
||||||
<li>
|
|
||||||
${message.get_title()}
|
|
||||||
<p>${message.get_content()[:80]}</p>
|
|
||||||
</li>
|
|
||||||
% endfor
|
|
||||||
</ul>
|
|
||||||
% endfor
|
|
||||||
</%def>
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue