##// 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 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 270 Attach variables into template context called `c`, please note that
271 271 request could be pylons or pyramid request in here.
@@ -387,9 +387,7 b' def attach_context_attributes(context, r'
387 387 context.csrf_token = auth.get_csrf_token()
388 388 context.backends = rhodecode.BACKENDS.keys()
389 389 context.backends.sort()
390 context.unread_notifications = NotificationModel().get_unread_cnt_for_user(
391 context.rhodecode_user.user_id)
392
390 context.unread_notifications = NotificationModel().get_unread_cnt_for_user(user_id)
393 391 context.pyramid_request = pyramid.threadlocal.get_current_request()
394 392
395 393
@@ -440,7 +438,7 b' class BaseController(WSGIController):'
440 438 """
441 439 # on each call propagate settings calls into global settings.
442 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 443 # TODO: Remove this when fixed in attach_context_attributes()
446 444 c.repo_name = get_repo_slug(request) # can be empty
@@ -121,7 +121,7 b' def add_pylons_context(event):'
121 121 # Setup the pylons context object ('c')
122 122 context = ContextObj()
123 123 context.rhodecode_user = auth_user
124 attach_context_attributes(context, request)
124 attach_context_attributes(context, request, request.user.user_id)
125 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