Support Django 1.4, 1.5 and 1.6
The default session serializer switched to JSONSerializer in Django-1.6. Unfortunately, it can't serialize arbitrary objects (such as datetime instances), there we have to stay with PickleSerializer (compare with https://docs.djangoproject.com/en/1.6/topics/http/sessions/#write-your-own-serializer). Sets Django==1.4 for the py27dj14 tox testenv. Don't relax the version requirements just yet. Change-Id: Ifb5a68950fa6a4a652a0fb0cb81048d89763ec3f
This commit is contained in:
parent
bceccf9516
commit
40b654e6ee
|
@ -48,3 +48,6 @@ USE_TZ = True
|
|||
OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT = False
|
||||
|
||||
OPENSTACK_KEYSTONE_DEFAULT_DOMAIN = 'domain'
|
||||
|
||||
# NOTE(saschpe): The openstack_auth.user.Token object isn't JSON-serializable ATM
|
||||
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer'
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from django.conf.urls.defaults import patterns, include, url
|
||||
from django.conf.urls import patterns, include, url
|
||||
from django.views.generic import TemplateView
|
||||
|
||||
from openstack_auth.utils import patch_middleware_get_user
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
import logging
|
||||
|
||||
import django
|
||||
from django import shortcuts
|
||||
from django.conf import settings
|
||||
from django.contrib.auth import REDIRECT_FIELD_NAME
|
||||
|
@ -55,7 +56,13 @@ def login(request):
|
|||
initial.update({'region': requested_region})
|
||||
|
||||
if request.method == "POST":
|
||||
form = curry(Login, request)
|
||||
# NOTE(saschpe): Since https://code.djangoproject.com/ticket/15198,
|
||||
# the 'request' object is passed directly to AuthenticationForm in
|
||||
# django.contrib.auth.views#login:
|
||||
if django.VERSION >= (1, 6):
|
||||
form = curry(Login)
|
||||
else:
|
||||
form = curry(Login, request)
|
||||
else:
|
||||
form = curry(Login, initial=initial)
|
||||
|
||||
|
|
6
tox.ini
6
tox.ini
|
@ -12,6 +12,12 @@ deps = -r{toxinidir}/requirements.txt
|
|||
-r{toxinidir}/test-requirements.txt
|
||||
commands = python openstack_auth/tests/run_tests.py
|
||||
|
||||
[testenv:py27dj14]
|
||||
deps = pbr>=0.5.21,<1.0
|
||||
Django==1.4
|
||||
python-keystoneclient>=0.3.2
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
|
||||
[testenv:pep8]
|
||||
commands = flake8
|
||||
|
||||
|
|
Loading…
Reference in New Issue