##// END OF EJS Templates
core: improve attach context attribute to rely strictly on already provided user.
marcink -
r1776:e85e3fbe default
parent child Browse files
Show More
@@ -265,7 +265,7 b' class BasicAuth(AuthBasicAuthenticator):'
265 __call__ = authenticate
265 __call__ = authenticate
266
266
267
267
268 def attach_context_attributes(context, request):
268 def attach_context_attributes(context, request, user_id):
269 """
269 """
270 Attach variables into template context called `c`, please note that
270 Attach variables into template context called `c`, please note that
271 request could be pylons or pyramid request in here.
271 request could be pylons or pyramid request in here.
@@ -387,9 +387,7 b' def attach_context_attributes(context, r'
387 context.csrf_token = auth.get_csrf_token()
387 context.csrf_token = auth.get_csrf_token()
388 context.backends = rhodecode.BACKENDS.keys()
388 context.backends = rhodecode.BACKENDS.keys()
389 context.backends.sort()
389 context.backends.sort()
390 context.unread_notifications = NotificationModel().get_unread_cnt_for_user(
390 context.unread_notifications = NotificationModel().get_unread_cnt_for_user(user_id)
391 context.rhodecode_user.user_id)
392
393 context.pyramid_request = pyramid.threadlocal.get_current_request()
391 context.pyramid_request = pyramid.threadlocal.get_current_request()
394
392
395
393
@@ -440,7 +438,7 b' class BaseController(WSGIController):'
440 """
438 """
441 # on each call propagate settings calls into global settings.
439 # on each call propagate settings calls into global settings.
442 set_rhodecode_config(config)
440 set_rhodecode_config(config)
443 attach_context_attributes(c, request)
441 attach_context_attributes(c, request, c.rhodecode_user.user_id)
444
442
445 # TODO: Remove this when fixed in attach_context_attributes()
443 # TODO: Remove this when fixed in attach_context_attributes()
446 c.repo_name = get_repo_slug(request) # can be empty
444 c.repo_name = get_repo_slug(request) # can be empty
@@ -121,7 +121,7 b' def add_pylons_context(event):'
121 # Setup the pylons context object ('c')
121 # Setup the pylons context object ('c')
122 context = ContextObj()
122 context = ContextObj()
123 context.rhodecode_user = auth_user
123 context.rhodecode_user = auth_user
124 attach_context_attributes(context, request)
124 attach_context_attributes(context, request, request.user.user_id)
125 pylons.tmpl_context._push_object(context)
125 pylons.tmpl_context._push_object(context)
126
126
127
127
General Comments 0
You need to be logged in to leave comments. Login now