Révision c62aae38
Ajouté par Jérôme Schneider il y a plus de 9 ans
mandaye/server.py | ||
---|---|---|
11 | 11 |
from urlparse import urlparse |
12 | 12 |
|
13 | 13 |
from mandaye import config |
14 |
from mandaye.exceptions import ImproperlyConfigured
|
|
14 |
from mandaye.backends.default import storage_conn
|
|
15 | 15 |
from mandaye.dispatcher import Dispatcher |
16 |
from mandaye.exceptions import ImproperlyConfigured |
|
16 | 17 |
from mandaye.log import logger, UuidFilter |
17 | 18 |
from mandaye.handlers.default import MandayeRedirectHandler, MandayeErrorHandler |
18 | 19 |
from mandaye.http import HTTPHeader, HTTPRequest, HTTPResponse |
19 | 20 |
from mandaye.response import _404, _502, _500 |
20 |
from mandaye.db import sql_session |
|
21 | 21 |
|
22 | 22 |
|
23 | 23 |
def get_response(env, request, url, cookiejar=None): |
... | ... | |
137 | 137 |
response = self.on_request(start_response) |
138 | 138 |
if not response: |
139 | 139 |
response = self.on_response(start_response, _404(env['PATH_INFO'])) |
140 |
sql_session.commit() |
|
140 |
if config.storage_backend == 'mandaye.backends.sql': |
|
141 |
storage_conn.commit() |
|
141 | 142 |
except Exception, e: |
142 |
sql_session.rollback() |
|
143 |
if config.storage_backend == 'mandaye.backends.sql': |
|
144 |
storage_conn.rollback() |
|
143 | 145 |
if self.raven_client: |
144 | 146 |
self.raven_client.captureException() |
145 | 147 |
response = self.on_response(start_response, _500(env['PATH_INFO'], "Unhandled exception", |
146 | 148 |
exception=e, env=env)) |
147 | 149 |
finally: |
148 |
sql_session.close() |
|
150 |
if config.storage_backend == 'mandaye.backends.sql': |
|
151 |
storage_conn.close() |
|
149 | 152 |
return response |
150 | 153 |
|
151 | 154 |
def _get_uuid(self): |
Formats disponibles : Unified diff
backends: complete rewrite of the interface
The old interface was to specific for sqlalchemy this new one allow to
write new backends
WARNING: this commit could break compability for some filter which uses
the old interface