##// END OF EJS Templates
subscribers: optimized used of threadglobals and fix python3 compat
super-admin -
r5062:0a4c1892 default
parent child Browse files
Show More
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2 1
3 2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 3 #
@@ -30,7 +29,6 b' import subprocess'
30 29
31 30
32 31 from dateutil.parser import parse
33 from pyramid.threadlocal import get_current_request
34 32 from pyramid.interfaces import IRoutesMapper
35 33 from pyramid.settings import asbool
36 34 from pyramid.path import AssetResolver
@@ -38,6 +36,7 b' from threading import Thread'
38 36
39 37 from rhodecode.config.jsroutes import generate_jsroutes_content
40 38 from rhodecode.lib.base import get_auth_user
39 from rhodecode.lib.celerylib.loader import set_celery_conf
41 40
42 41 import rhodecode
43 42
@@ -50,6 +49,7 b' def add_renderer_globals(event):'
50 49
51 50 # TODO: When executed in pyramid view context the request is not available
52 51 # in the event. Find a better solution to get the request.
52 from pyramid.threadlocal import get_current_request
53 53 request = event['request'] or get_current_request()
54 54
55 55 # Add Pyramid translation as '_' to context
@@ -70,7 +70,6 b' def set_user_lang(event):'
70 70
71 71
72 72 def update_celery_conf(event):
73 from rhodecode.lib.celerylib.loader import set_celery_conf
74 73 log.debug('Setting celery config from new request')
75 74 set_celery_conf(request=event.request, registry=event.request.registry)
76 75
@@ -79,6 +78,7 b' def add_request_user_context(event):'
79 78 """
80 79 Adds auth user into request context
81 80 """
81
82 82 request = event.request
83 83 # access req_id as soon as possible
84 84 req_id = request.req_id
@@ -307,7 +307,7 b' def write_js_routes_if_enabled(event):'
307 307 static_path, 'js', 'rhodecode', 'routes.js')
308 308
309 309 try:
310 with io.open(jsroutes_file_path, 'w', encoding='utf-8') as f:
310 with open(jsroutes_file_path, 'w', encoding='utf-8') as f:
311 311 f.write(jsroutes_file_content)
312 312 except Exception:
313 313 log.exception('Failed to write routes.js into %s', jsroutes_file_path)
General Comments 0
You need to be logged in to leave comments. Login now