diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..cffb395e08c615c430c8c3821782c4993f052e92 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,128 @@ +before_script: +- pip install tox setuptools + +flake8: + image: "python:2.7" + cache: + key: flake8 + paths: + - .tox/flake8 + script: + - tox -e flake8 + +check_rst: + image: "python:2.7" + cache: + key: check_rst + paths: + - .tox/check_rst + script: + - tox -e check_rst + +py27-django17: + image: "python:2.7" + cache: + key: py27-django17 + paths: + - .tox/py27-django17 + script: + - tox -e py27-django17 + +py27-django18: + image: "python:2.7" + cache: + key: py27-django18 + paths: + - .tox/py27-django18 + script: + - tox -e py27-django18 + +py27-django19: + image: "python:2.7" + cache: + key: py27-django19 + paths: + - .tox/py27-django19 + script: + - tox -e py27-django19 + +py27-django110: + image: "python:2.7" + cache: + key: py27-django110 + paths: + - .tox/py27-django110 + script: + - tox -e py27-django110 + +py34-django17: + image: "python:3.4" + cache: + key: py34-django17 + paths: + - .tox/py34-django17 + script: + - tox -e py34-django17 + +py34-django18: + image: "python:3.4" + cache: + key: py34-django18 + paths: + - .tox/py34-django18 + script: + - tox -e py34-django18 + +py34-django19: + image: "python:3.4" + cache: + key: py34-django19 + paths: + - .tox/py34-django19 + script: + - tox -e py34-django19 + +py34-django110: + image: "python:3.4" + cache: + key: py34-django110 + paths: + - .tox/py34-django110 + script: + - tox -e py34-django110 + +py35-django18: + image: "python:3.5" + cache: + key: py35-django18 + paths: + - .tox/py35-django18 + script: + - tox -e py35-django18 + +py35-django19: + image: "python:3.5" + cache: + key: py35-django19 + paths: + - .tox/py35-django19 + script: + - tox -e py35-django19 + +py35-django110: + image: "python:3.5" + cache: + key: py35-django110 + paths: + - .tox/py35-django110 + script: + - tox -e py35-django110 + +coverage: + image: "python:2.7" + cache: + key: coverage + paths: + - .tox/coverage + script: + - tox -e coverage diff --git a/.travis.yml b/.travis.yml index 70393e680722ee5ee523385ac1ae62ee8a21acdc..4a69d3e1d10279ae02f40b7018a40647b6384087 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,16 +11,22 @@ matrix: env: TOX_ENV=py27-django18 - python: "2.7" env: TOX_ENV=py27-django19 + - python: "2.7" + env: TOX_ENV=py27-django110 - python: "3.4" env: TOX_ENV=py34-django17 - python: "3.4" env: TOX_ENV=py34-django18 - python: "3.4" env: TOX_ENV=py34-django19 + - python: "3.4" + env: TOX_ENV=py34-django110 - python: "3.5" env: TOX_ENV=py35-django18 - python: "3.5" env: TOX_ENV=py35-django19 + - python: "3.5" + env: TOX_ENV=py35-django110 - python: "2.7" env: TOX_ENV=coverage cache: diff --git a/CHANGELOG.rst b/CHANGELOG.rst index f571cdaa44a80c64f9a948dd94cef1cc0c374583..1e6760ed91efb7dd0969d0e0fdc638cb6da81ab1 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,6 +6,22 @@ All notable changes to this project will be documented in this file. .. contents:: Table of Contents :depth: 2 +v0.7.2 - 2016-08-31 +=================== + +Added +----- +* Add Django 1.10 support +* Add support of gitlab continuous integration + +Fixed +----- +* Fix BootsrapForm: placeholder on Input and Textarea only, use class form-control on + Input, Select and Textarea. +* Fix lang attribute in django 1.7. On html pages, the lang attribute of the was not + present in django 1.7. We use now a methode to display it that is also available in django 1.7 + + v0.7.1 - 2016-08-24 =================== diff --git a/Makefile b/Makefile index 08d013f3d104ee4e52a1807caf954577ac8ec37f..491228577d06d0c31ca17d14eb2d0d9cce7d0cdd 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,7 @@ dist: test_venv/bin/python: virtualenv test_venv - test_venv/bin/pip install -U --requirement requirements-dev.txt 'Django<1.10' + test_venv/bin/pip install -U --requirement requirements-dev.txt 'Django<1.11' test_venv/cas/manage.py: test_venv mkdir -p test_venv/cas diff --git a/README.rst b/README.rst index d67a3e0e2806120811002d1f8d0dd11e6f3dd052..b7dd4c554bae0ab6a8b34a3b62469764a576113f 100644 --- a/README.rst +++ b/README.rst @@ -29,7 +29,7 @@ Dependencies ``django-cas-server`` depends on the following python packages: -* Django >= 1.7.1 < 1.10 +* Django >= 1.7.1 < 1.11 * requests >= 2.4 * requests_futures >= 0.9.5 * lxml >= 3.4 diff --git a/cas_server/__init__.py b/cas_server/__init__.py index 959d38686be4abed1950ce6b040b83f22d1861f4..43c6d63a8219a1fad561569271d3d75999e54eed 100644 --- a/cas_server/__init__.py +++ b/cas_server/__init__.py @@ -11,7 +11,7 @@ """A django CAS server application""" #: version of the application -VERSION = '0.7.1' +VERSION = '0.7.2' #: path the the application configuration class default_app_config = 'cas_server.apps.CasAppConfig' diff --git a/cas_server/forms.py b/cas_server/forms.py index 54afb7ffa3a3412affee2cf16ad9b83a696d641b..cc6b2b086addb90c120d88ec9287f552acadd675 100644 --- a/cas_server/forms.py +++ b/cas_server/forms.py @@ -12,6 +12,7 @@ from .default_settings import settings from django import forms +from django.forms import widgets from django.utils.translation import ugettext_lazy as _ import cas_server.utils as utils @@ -27,13 +28,13 @@ class BootsrapForm(forms.Form): def __init__(self, *args, **kwargs): super(BootsrapForm, self).__init__(*args, **kwargs) for field in self.fields.values(): - # Only tweak the fiel if it will be displayed - if not isinstance(field.widget, forms.HiddenInput): + # Only tweak the field if it will be displayed + if not isinstance(field.widget, widgets.HiddenInput): attrs = {} - if not isinstance(field.widget, forms.CheckboxInput): + if isinstance(field.widget, (widgets.Input, widgets.Select, widgets.Textarea)): attrs['class'] = "form-control" - if field.label: # pragma: no branch (currently all field are hidden or labeled) - attrs["placeholder"] = field.label + if isinstance(field.widget, (widgets.Input, widgets.Textarea)) and field.label: + attrs["placeholder"] = field.label if field.required: attrs["required"] = "required" field.widget.attrs.update(attrs) diff --git a/cas_server/templates/cas_server/base.html b/cas_server/templates/cas_server/base.html index 2a2d8e1866b36a1fbc45567cd06696df85e1e08d..a3dd3a72e45c176e5dcea27b171ce9035cf2a839 100644 --- a/cas_server/templates/cas_server/base.html +++ b/cas_server/templates/cas_server/base.html @@ -1,5 +1,5 @@ -{% load i18n %}{% load staticfiles %} - +{% load i18n %}{% load staticfiles %}{% get_current_language as LANGUAGE_CODE %} + diff --git a/cas_server/tests/settings.py b/cas_server/tests/settings.py index e332688c04f46a304b40f157af0729d24e9bc2a2..617f3641902589995ec714ccc86a96071958a9fb 100644 --- a/cas_server/tests/settings.py +++ b/cas_server/tests/settings.py @@ -11,6 +11,7 @@ https://docs.djangoproject.com/en/1.9/ref/settings/ """ import os +import django # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) @@ -40,7 +41,7 @@ INSTALLED_APPS = [ 'cas_server', ] -MIDDLEWARE_CLASSES = [ +MIDDLEWARE = [ 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', @@ -50,6 +51,8 @@ MIDDLEWARE_CLASSES = [ 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.locale.LocaleMiddleware', ] +if django.VERSION < (1, 10): + MIDDLEWARE_CLASSES = MIDDLEWARE TEMPLATES = [ { diff --git a/requirements.txt b/requirements.txt index b7518f54f47227d4d2fb9f5a6fc71a164b8dc733..011a59ec01a56a8671866612e4acfd64dc3188ee 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -Django >= 1.7.1,<1.10 +Django >= 1.7.1,<1.11 setuptools>=5.5 requests>=2.4 requests_futures>=0.9.5 diff --git a/setup.py b/setup.py index 89c1a9cefb7b4fb82713fc032b1d1dabf7a7b0ff..0c0cfaad799fbbc15ad5f1b662c82d9a5551be1c 100644 --- a/setup.py +++ b/setup.py @@ -34,6 +34,7 @@ if __name__ == '__main__': 'Framework :: Django :: 1.7', 'Framework :: Django :: 1.8', 'Framework :: Django :: 1.9', + 'Framework :: Django :: 1.10', 'Intended Audience :: Developers', 'Intended Audience :: System Administrators', 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)', @@ -58,7 +59,7 @@ if __name__ == '__main__': }, keywords=['django', 'cas', 'cas3', 'server', 'sso', 'single sign-on', 'authentication', 'auth'], install_requires=[ - 'Django >= 1.7,<1.10', 'requests >= 2.4', 'requests_futures >= 0.9.5', + 'Django >= 1.7,<1.11', 'requests >= 2.4', 'requests_futures >= 0.9.5', 'lxml >= 3.4', 'six >= 1' ], url="https://github.com/nitmir/django-cas-server", diff --git a/tox.ini b/tox.ini index 4ab3f52ca7622a0df6407e15e51398ddbb419803..ca7239289e09e4cb2203f20715e0a95473ae2ff6 100644 --- a/tox.ini +++ b/tox.ini @@ -5,11 +5,14 @@ envlist= py27-django17, py27-django18, py27-django19, + py27-django110, py34-django17, py34-django18, py34-django19, + py34-django110, py35-django18, py35-django19, + py35-django110, [flake8] max-line-length=100 @@ -53,6 +56,12 @@ deps = Django>=1.9,<1.10 {[base]deps} +[testenv:py27-django110] +basepython=python2.7 +deps = + Django>=1.10,<1.11 + {[base]deps} + [testenv:py34-django17] basepython=python3.4 deps = @@ -71,6 +80,12 @@ deps = Django>=1.9,<1.10 {[base]deps} +[testenv:py34-django110] +basepython=python3.4 +deps = + Django>=1.10,<1.11 + {[base]deps} + [testenv:py35-django18] basepython=python3.5 deps = @@ -83,6 +98,12 @@ deps = Django>=1.9,<1.10 {[base]deps} +[testenv:py35-django110] +basepython=python3.5 +deps = + Django>=1.10,<1.11 + {[base]deps} + [testenv:flake8] basepython=python @@ -114,7 +135,7 @@ deps= codacy-coverage skip_install=True commands= - py.test --cov=cas_server --cov-report xml + py.test --cov=cas_server --cov-report xml --cov-report term python-codacy-coverage -r {toxinidir}/coverage.xml {[post_cmd]commands} whitelist_externals={[post_cmd]whitelist_externals}