diff --git a/mandaye/__init__.py b/mandaye/__init__.py index e69de29..2e94ead 100644 --- a/mandaye/__init__.py +++ b/mandaye/__init__.py @@ -0,0 +1 @@ +VERSION=0.1 diff --git a/mandaye/config.py b/mandaye/config.py index c525ff6..7810488 100644 --- a/mandaye/config.py +++ b/mandaye/config.py @@ -1,5 +1,5 @@ -# Mandaye configuration +# Mandaye configuration host = "127.0.0.1" port = 8088 @@ -18,69 +18,30 @@ template_directory = "mandaye/templates" # Follow the rfc 1738 http://rfc.net/rfc1738.html db_url = 'sqlite:///test.db' -from filters.vincennes import biblio_html_login_page -from filters.vincennes import biblio_html -from filters.default import MandayeFilter -biblio_mapping = { - r'/': { - 'on_response_filters': [{ - 'type': 'data', - 'filter': biblio_html - }] - }, - r'/mandaye/login$': { - 'method': 'GET', - 'response': { - 'dispatcher_method': 'login', - 'values': { - 'form_action': '/sezhame/page/connexion-abonne', - 'from_headers': { 'Content-Type': 'application/x-www-form-urlencoded' }, - 'form_values': { 'user': '', - 'password': '', - 'op': 'Se connecter', - 'form_id': 'dk_opac15_login_form' }, - 'username_field': 'user', - 'password_field': 'password' - } - } - }, - r'/mandaye/connection$': { - 'method': 'GET', - 'response': { - 'dispatcher_method': 'connection', - 'values': { - 'destination': 'https://test.vincennes.fr/comptecitoyen/auth', - 'next_url': 'http://biblio.local:8088/mandaye/login', - 'service_name': 'biblio' - } - } - }, - r'/sezhame/page/connexion-abonne$': { - 'method': 'GET', - 'on_response_filters': [{ - 'type': 'data', - 'filter': biblio_html_login_page - },] - }, -} +#example_mapping = { +# r'/': { +# 'on_response_filters': [{ +# 'type': 'data', +# 'filter': my_filter +# }] +# }, +# r'/test$': { +# 'method': 'GET', +# 'response': { +# 'dispatcher_method': 'my_test', +# 'values': { +# 'toto': 'titi', +# } +# } +# }, +#} from dispatchers.default import Dispatcher -from dispatchers.vincennes import VincennesDispatcher -# hosts = {'lamereasyl42': r'/': {'dispatcher': MyDispatcherBiatch, 'mapping': dick}} hosts = { - 'sfd.local:8088': [ - (r'/', Dispatcher('http://www.sfdiabete.org')), - ], - 'linuxfr.local:8088': [ - (r'/', Dispatcher('http://linuxfr.org')), - ], - 'biblio.local:8088': [ - (r'/', VincennesDispatcher('http://biblio.vincennes.fr', biblio_mapping)), - ], 'localhost:8088': [ - (r'/', Dispatcher('http://localhost')), + (r'/', Dispatcher('http://perdu.com/')), ], } diff --git a/mandaye/response.py b/mandaye/response.py index 1e396b0..4e5230b 100644 --- a/mandaye/response.py +++ b/mandaye/response.py @@ -36,7 +36,7 @@ def _401(msg): serve_template("response.html", title=title, body=msg)) def _404(path): - logging.waring("[404]: %s not found" % path) + logging.warning("[404]: %s not found" % path) title = "Not Found" body = "The requested URL %s was not found on this server." % path headers = HTTPHeader({'Content-Type': ['text/html']}) diff --git a/mandaye/server.py b/mandaye/server.py index 2e6a602..722d5e5 100644 --- a/mandaye/server.py +++ b/mandaye/server.py @@ -40,7 +40,7 @@ class MandayeApp(object): self.dispatcher.init(env) return self.on_request(start_response) else: - return self.on_response(start_response, _404) + return self.on_response(start_response, _404(env['PATH_INFO'])) def _get_dispatcher(self, local_host, path_info): """ return the right dispatcher diff --git a/setup.py b/setup.py index 4522a47..515c40c 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ import mandaye -from setuptools import setup, find_pacakges +from setuptools import setup, find_packages setup(name="mandaye", version=mandaye.VERSION, @@ -18,13 +18,14 @@ setup(name="mandaye", maintainer="Jerome Schneider", maintainer_email="jschneider@entrouvert.com", scripts=['mandayectl'], - packages=find_pacakges(), + packages=find_packages(), package_data={}, install_requires=[ 'beaker>=1.5', 'gevent>=0.13', 'mako>=0.3', 'poster>=0.8', - 'sqlachemy>=0.6' + 'pycrypto>=2.0', + 'sqlalchemy>=0.6', ], )