Show More
@@ -374,20 +374,25 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 | } | |
386 | for k, v in request.session.items(): |
|
383 | ||
387 | pref = 'rc_user_session_attr.' |
|
384 | if not is_api: | |
388 | if k and k.startswith(pref): |
|
385 | # don't access pyramid session for API calls | |
389 | k = k[len(pref):] |
|
386 | if diffmode and diffmode != request.session.get('rc_user_session_attr.diffmode'): | |
390 | session_attrs[k] = v |
|
387 | request.session['rc_user_session_attr.diffmode'] = diffmode | |
|
388 | ||||
|
389 | # session settings per user | |||
|
390 | ||||
|
391 | for k, v in request.session.items(): | |||
|
392 | pref = 'rc_user_session_attr.' | |||
|
393 | if k and k.startswith(pref): | |||
|
394 | k = k[len(pref):] | |||
|
395 | session_attrs[k] = v | |||
391 |
|
396 | |||
392 | context.user_session_attrs = session_attrs |
|
397 | context.user_session_attrs = session_attrs | |
393 |
|
398 | |||
@@ -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 = |
|
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