##// END OF EJS Templates
sessions: don't touch session for API calls.
marcink -
r3749:7da1bd06 new-ui
parent child Browse files
Show More
@@ -374,15 +374,20 b' def attach_context_attributes(context, r'
374 "sideside": "sideside"
374 "sideside": "sideside"
375 }.get(request.GET.get('diffmode'))
375 }.get(request.GET.get('diffmode'))
376
376
377 if diffmode and diffmode != request.session.get('rc_user_session_attr.diffmode'):
377 is_api = hasattr(request, 'rpc_user')
378 request.session['rc_user_session_attr.diffmode'] = diffmode
379
380 # session settings per user
381 session_attrs = {
378 session_attrs = {
382 # defaults
379 # defaults
383 "clone_url_format": "http",
380 "clone_url_format": "http",
384 "diffmode": "sideside"
381 "diffmode": "sideside"
385 }
382 }
383
384 if not is_api:
385 # don't access pyramid session for API calls
386 if diffmode and diffmode != request.session.get('rc_user_session_attr.diffmode'):
387 request.session['rc_user_session_attr.diffmode'] = diffmode
388
389 # session settings per user
390
386 for k, v in request.session.items():
391 for k, v in request.session.items():
387 pref = 'rc_user_session_attr.'
392 pref = 'rc_user_session_attr.'
388 if k and k.startswith(pref):
393 if k and k.startswith(pref):
@@ -419,8 +424,12 b' def attach_context_attributes(context, r'
419 'extra': {'plugins': {}}
424 'extra': {'plugins': {}}
420 }
425 }
421 # END CONFIG VARS
426 # END CONFIG VARS
427 if is_api:
428 csrf_token = None
429 else:
430 csrf_token = auth.get_csrf_token(session=request.session)
422
431
423 context.csrf_token = auth.get_csrf_token(session=request.session)
432 context.csrf_token = csrf_token
424 context.backends = rhodecode.BACKENDS.keys()
433 context.backends = rhodecode.BACKENDS.keys()
425 context.backends.sort()
434 context.backends.sort()
426 unread_count = 0
435 unread_count = 0
General Comments 0
You need to be logged in to leave comments. Login now