Show More
@@ -19,15 +19,15 b'' | |||
|
19 | 19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ |
|
20 | 20 | import io |
|
21 | 21 | import re |
|
22 | import os | |
|
22 | 23 | import datetime |
|
23 | 24 | import logging |
|
24 | 25 | import Queue |
|
25 | 26 | import subprocess32 |
|
26 | import os | |
|
27 | 27 | |
|
28 | 28 | |
|
29 | 29 | from dateutil.parser import parse |
|
30 | from pyramid.i18n import get_localizer | |
|
30 | from pyramid.httpexceptions import HTTPBadRequest | |
|
31 | 31 | from pyramid.threadlocal import get_current_request |
|
32 | 32 | from pyramid.interfaces import IRoutesMapper |
|
33 | 33 | from pyramid.settings import asbool |
@@ -61,7 +61,19 b' def add_renderer_globals(event):' | |||
|
61 | 61 | |
|
62 | 62 | def add_localizer(event): |
|
63 | 63 | request = event.request |
|
64 | try: | |
|
64 | 65 | localizer = request.localizer |
|
66 | except Exception: | |
|
67 | log.exception('Failed to get localizer') | |
|
68 | # NOTE(marcink): Handle bug in pyramid by malformed GET params could crash | |
|
69 | # this resulting on various odd errors on missing translators | |
|
70 | # see: https://github.com/Pylons/pyramid/issues/3399 | |
|
71 | ||
|
72 | def dummy_translate(*args, **kwargs): | |
|
73 | return ''.join(args) | |
|
74 | request.translate = tsf | |
|
75 | request.plularize = dummy_translate | |
|
76 | raise HTTPBadRequest() | |
|
65 | 77 | |
|
66 | 78 | def auto_translate(*args, **kwargs): |
|
67 | 79 | return localizer.translate(tsf(*args, **kwargs)) |
General Comments 0
You need to be logged in to leave comments.
Login now