##// END OF EJS Templates
core: always attach pyramid context into request...
marcink -
r1896:936e31fc default
parent child Browse files
Show More
@@ -281,8 +281,8 b' def request_view(request):'
281 })
281 })
282
282
283 # register some common functions for usage
283 # register some common functions for usage
284 attach_context_attributes(TemplateArgs(), request, request.rpc_user.user_id,
284 attach_context_attributes(
285 attach_to_request=True)
285 TemplateArgs(), request, request.rpc_user.user_id)
286
286
287 try:
287 try:
288 ret_value = func(**call_params)
288 ret_value = func(**call_params)
@@ -265,13 +265,13 b' class BasicAuth(AuthBasicAuthenticator):'
265 __call__ = authenticate
265 __call__ = authenticate
266
266
267
267
268 def attach_context_attributes(context, request, user_id, attach_to_request=False):
269 def calculate_version_hash():
268 def calculate_version_hash():
270 return md5(
269 return md5(
271 config.get('beaker.session.secret', '') +
270 config.get('beaker.session.secret', '') +
272 rhodecode.__version__)[:8]
271 rhodecode.__version__)[:8]
273
272
274
273
274 def attach_context_attributes(context, request, user_id):
275 """
275 """
276 Attach variables into template context called `c`, please note that
276 Attach variables into template context called `c`, please note that
277 request could be pylons or pyramid request in here.
277 request could be pylons or pyramid request in here.
@@ -397,11 +397,10 b' def calculate_version_hash():'
397 context.backends = rhodecode.BACKENDS.keys()
397 context.backends = rhodecode.BACKENDS.keys()
398 context.backends.sort()
398 context.backends.sort()
399 context.unread_notifications = NotificationModel().get_unread_cnt_for_user(user_id)
399 context.unread_notifications = NotificationModel().get_unread_cnt_for_user(user_id)
400 if attach_to_request:
400 context.pyramid_request = pyramid.threadlocal.get_current_request()
401 request.call_context = context
402 else:
403 context.pyramid_request = pyramid.threadlocal.get_current_request()
404
401
402 # attach the whole call context to the request
403 request.call_context = context
405
404
406
405
407 def get_auth_user(environ):
406 def get_auth_user(environ):
General Comments 0
You need to be logged in to leave comments. Login now