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 <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Alexandru DAMIAN 2015-05-14 14:40:10 +01:00 committed by Richard Purdie
parent 5da543c7b5
commit a5236be47f
3 changed files with 15 additions and 14 deletions

View File

@ -53,7 +53,11 @@ function webserverStartAll()
fi
retval=0
python $BBBASEDIR/lib/toaster/manage.py syncdb || retval=1
if [ "$TOASTER_MANAGED" '==' '1' ]; then
python $BBBASEDIR/lib/toaster/manage.py syncdb || retval=1
else
python $BBBASEDIR/lib/toaster/manage.py syncdb --noinput || retval=1
fi
python $BBBASEDIR/lib/toaster/manage.py migrate orm || retval=2
if [ $retval -eq 1 ]; then
echo "Failed db sync, stopping system start" 1>&2

View File

@ -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)

View File

@ -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