Mathias 7 years ago
parent
commit
ab6e8cc793
  1. 5
      muk_web_preview_mail/controllers/main.py
  2. 5
      muk_web_preview_msoffice/controllers/main.py

5
muk_web_preview_mail/controllers/main.py

@ -30,6 +30,7 @@ import collections
import werkzeug.exceptions import werkzeug.exceptions
from urllib.parse import urlparse from urllib.parse import urlparse
from urllib.parse import parse_qsl
from odoo import _ from odoo import _
from odoo import tools from odoo import tools
@ -61,14 +62,14 @@ class MailParserController(http.Controller):
except KeyError: except KeyError:
message = None message = None
if not message: if not message:
if not bool(urlparse.urlparse(url).netloc):
if not bool(urlparse(url).netloc):
url_parts = url.split('?') url_parts = url.split('?')
path = url_parts[0] path = url_parts[0]
query_string = url_parts[1] if len(url_parts) > 1 else None query_string = url_parts[1] if len(url_parts) > 1 else None
router = request.httprequest.app.get_db_router(request.db).bind('') router = request.httprequest.app.get_db_router(request.db).bind('')
match = router.match(path, query_args=query_string) match = router.match(path, query_args=query_string)
method = router.match(path, query_args=query_string)[0] method = router.match(path, query_args=query_string)[0]
params = dict(urlparse.parse_qsl(query_string))
params = dict(parse_qsl(query_string))
if len(match) > 1: if len(match) > 1:
params.update(match[1]) params.update(match[1])
response = method(**params) response = method(**params)

5
muk_web_preview_msoffice/controllers/main.py

@ -33,6 +33,7 @@ import collections
import werkzeug.exceptions import werkzeug.exceptions
from contextlib import closing from contextlib import closing
from urllib.parse import urlparse from urllib.parse import urlparse
from urllib.parse import parse_qsl
from odoo import _ from odoo import _
from odoo import tools from odoo import tools
@ -71,7 +72,7 @@ class MSOfficeParserController(http.Controller):
return response return response
def _get_response(self, url, export_filename): def _get_response(self, url, export_filename):
if not bool(urlparse.urlparse(url).netloc):
if not bool(urlparse(url).netloc):
method, params = self._get_route(url) method, params = self._get_route(url)
response = method(**params) response = method(**params)
if not response.status_code == 200: if not response.status_code == 200:
@ -103,7 +104,7 @@ class MSOfficeParserController(http.Controller):
router = request.httprequest.app.get_db_router(request.db).bind('') router = request.httprequest.app.get_db_router(request.db).bind('')
match = router.match(path, query_args=query_string) match = router.match(path, query_args=query_string)
method = router.match(path, query_args=query_string)[0] method = router.match(path, query_args=query_string)[0]
params = dict(urlparse.parse_qsl(query_string))
params = dict(parse_qsl(query_string))
if len(match) > 1: if len(match) > 1:
params.update(match[1]) params.update(match[1])
return method, params return method, params

Loading…
Cancel
Save