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.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
     1
from django import forms
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
     2
from django.core.urlresolvers import reverse
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
     3
from django.forms import ModelForm
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
     4
from django.http import HttpResponse, HttpResponseRedirect, Http404
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
     5
from django.shortcuts import render_to_response
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
     6
from django.template import RequestContext
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
     7
from django.utils.translation import ugettext as _, ugettext_lazy
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
     8
from cm.models import Text, TextVersion, Attachment, Comment
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
     9
from cm.cm_settings import DEFAULT_TIME_ZONE
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    10
import mimetypes
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    11
import simplejson
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    12
from cm.utils.timezone import tz_convert
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    13
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    14
def timezone_set(request):
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    15
    if request.method == 'POST':
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    16
        #if request.user.is_authenticated():
313
dcbb54cbfd06 silently swallow IOError in timezone setting
raph
parents: 0
diff changeset
    17
        try:
dcbb54cbfd06 silently swallow IOError in timezone setting
raph
parents: 0
diff changeset
    18
            tz = request.POST.get('tz', DEFAULT_TIME_ZONE)
dcbb54cbfd06 silently swallow IOError in timezone setting
raph
parents: 0
diff changeset
    19
            request.session['tz'] = tz
dcbb54cbfd06 silently swallow IOError in timezone setting
raph
parents: 0
diff changeset
    20
        except IOError:
dcbb54cbfd06 silently swallow IOError in timezone setting
raph
parents: 0
diff changeset
    21
            # silently swallow IOError
dcbb54cbfd06 silently swallow IOError in timezone setting
raph
parents: 0
diff changeset
    22
            pass
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    23
    
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    24
    return HttpResponse('')
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    25