From a5236be47fd62d41eaea2d4b4f1a394de0aac4a9 Mon Sep 17 00:00:00 2001 From: Alexandru DAMIAN Date: Thu, 14 May 2015 14:40:10 +0100 Subject: bitbake: toaster: enable server-side sessions for all usages In an effort to fix client-side session storage using cookies, we enable server-side session support for all pages. (Bitbake rev: ba10b6f89767c0dad8a2b064f42a84956764e9da) Signed-off-by: Alexandru DAMIAN Signed-off-by: Richard Purdie --- bitbake/lib/toaster/toastergui/views.py | 6 ++++-- bitbake/lib/toaster/toastermain/settings.py | 17 ++++++----------- 2 files changed, 10 insertions(+), 13 deletions(-) (limited to 'bitbake/lib') diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py index 9217d8a100..c16fc2219f 100755 --- a/bitbake/lib/toaster/toastergui/views.py +++ b/bitbake/lib/toaster/toastergui/views.py @@ -266,8 +266,10 @@ def _get_queryset(model, queryset, filter_string, search_term, ordering_string, # if the value is given explicitly as a GET parameter it will be the first selected, # otherwise the cookie value will be used. def _get_parameters_values(request, default_count, default_order): - pagesize = request.GET.get('count', request.COOKIES.get('count', default_count)) - orderby = request.GET.get('orderby', request.COOKIES.get('orderby', default_order)) + from django.core.urlresolvers import resolve + current_url = resolve(request.path_info).url_name + pagesize = request.GET.get('count', request.session.get('%s_count' % current_url, default_count)) + orderby = request.GET.get('orderby', request.session.get('%s_orderby' % current_url, default_order)) return (pagesize, orderby) diff --git a/bitbake/lib/toaster/toastermain/settings.py b/bitbake/lib/toaster/toastermain/settings.py index 80f26e0ce6..225138b32d 100644 --- a/bitbake/lib/toaster/toastermain/settings.py +++ b/bitbake/lib/toaster/toastermain/settings.py @@ -258,8 +258,13 @@ TEMPLATE_CONTEXT_PROCESSORS = ('django.contrib.auth.context_processors.auth', ) INSTALLED_APPS = ( - #'django.contrib.sites', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.messages', + 'django.contrib.sessions', + 'django.contrib.admin', 'django.contrib.staticfiles', + # Uncomment the next line to enable admin documentation: # 'django.contrib.admindocs', 'django.contrib.humanize', @@ -307,16 +312,6 @@ if os.environ.get('TOASTER_DEVEL', None) is not None: SOUTH_TESTS_MIGRATE = False -# if we run in managed mode, we need user support -if MANAGED: - INSTALLED_APPS = ('django.contrib.auth', - 'django.contrib.contenttypes', - 'django.contrib.messages', - 'django.contrib.sessions', - # Uncomment the next line to enable the admin: - 'django.contrib.admin', - ) + INSTALLED_APPS - # We automatically detect and install applications here if # they have a 'models.py' or 'views.py' file -- cgit v1.2.3-54-g00ecf