src/cm/views/timezone.py
author Simon Descarpentries <sid@sopinspace.com>
Wed, 09 May 2012 17:13:33 +0200
changeset 417 c5e91f204371
parent 313 dcbb54cbfd06
permissions -rw-r--r--
After investigations, commit the proposed patch by kklimonda presented with the following introduction : cm/templates/site/login_form.html template uses a relative url for the form action, which seems to break deployment in the subfolder when trailing slash is missing (the form redirects to the upper folder breaking login). Using {% url login %} (as in the attached patch) instead would fix the issue.

from django import forms
from django.core.urlresolvers import reverse
from django.forms import ModelForm
from django.http import HttpResponse, HttpResponseRedirect, Http404
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.utils.translation import ugettext as _, ugettext_lazy
from cm.models import Text, TextVersion, Attachment, Comment
from cm.cm_settings import DEFAULT_TIME_ZONE
import mimetypes
import simplejson
from cm.utils.timezone import tz_convert

def timezone_set(request):
    if request.method == 'POST':
        #if request.user.is_authenticated():
        try:
            tz = request.POST.get('tz', DEFAULT_TIME_ZONE)
            request.session['tz'] = tz
        except IOError:
            # silently swallow IOError
            pass
    
    return HttpResponse('')