Merge pull request #14 from nitmir/dev

Update version to 0.7.2

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 <html> was not
  present in django 1.7. We use now a methode to display it that is also available in django 1.7
This commit is contained in:
Valentin Samir 2016-08-31 16:52:14 +02:00 committed by GitHub
commit 7a86679281
12 changed files with 190 additions and 14 deletions

128
.gitlab-ci.yml Normal file
View File

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

View File

@ -11,16 +11,22 @@ matrix:
env: TOX_ENV=py27-django18 env: TOX_ENV=py27-django18
- python: "2.7" - python: "2.7"
env: TOX_ENV=py27-django19 env: TOX_ENV=py27-django19
- python: "2.7"
env: TOX_ENV=py27-django110
- python: "3.4" - python: "3.4"
env: TOX_ENV=py34-django17 env: TOX_ENV=py34-django17
- python: "3.4" - python: "3.4"
env: TOX_ENV=py34-django18 env: TOX_ENV=py34-django18
- python: "3.4" - python: "3.4"
env: TOX_ENV=py34-django19 env: TOX_ENV=py34-django19
- python: "3.4"
env: TOX_ENV=py34-django110
- python: "3.5" - python: "3.5"
env: TOX_ENV=py35-django18 env: TOX_ENV=py35-django18
- python: "3.5" - python: "3.5"
env: TOX_ENV=py35-django19 env: TOX_ENV=py35-django19
- python: "3.5"
env: TOX_ENV=py35-django110
- python: "2.7" - python: "2.7"
env: TOX_ENV=coverage env: TOX_ENV=coverage
cache: cache:

View File

@ -6,6 +6,22 @@ All notable changes to this project will be documented in this file.
.. contents:: Table of Contents .. contents:: Table of Contents
:depth: 2 :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 <html> 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 v0.7.1 - 2016-08-24
=================== ===================

View File

@ -38,7 +38,7 @@ dist:
test_venv/bin/python: test_venv/bin/python:
virtualenv test_venv 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 test_venv/cas/manage.py: test_venv
mkdir -p test_venv/cas mkdir -p test_venv/cas

View File

@ -29,7 +29,7 @@ Dependencies
``django-cas-server`` depends on the following python packages: ``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 >= 2.4
* requests_futures >= 0.9.5 * requests_futures >= 0.9.5
* lxml >= 3.4 * lxml >= 3.4

View File

@ -11,7 +11,7 @@
"""A django CAS server application""" """A django CAS server application"""
#: version of the application #: version of the application
VERSION = '0.7.1' VERSION = '0.7.2'
#: path the the application configuration class #: path the the application configuration class
default_app_config = 'cas_server.apps.CasAppConfig' default_app_config = 'cas_server.apps.CasAppConfig'

View File

@ -12,6 +12,7 @@
from .default_settings import settings from .default_settings import settings
from django import forms from django import forms
from django.forms import widgets
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
import cas_server.utils as utils import cas_server.utils as utils
@ -27,12 +28,12 @@ class BootsrapForm(forms.Form):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(BootsrapForm, self).__init__(*args, **kwargs) super(BootsrapForm, self).__init__(*args, **kwargs)
for field in self.fields.values(): for field in self.fields.values():
# Only tweak the fiel if it will be displayed # Only tweak the field if it will be displayed
if not isinstance(field.widget, forms.HiddenInput): if not isinstance(field.widget, widgets.HiddenInput):
attrs = {} attrs = {}
if not isinstance(field.widget, forms.CheckboxInput): if isinstance(field.widget, (widgets.Input, widgets.Select, widgets.Textarea)):
attrs['class'] = "form-control" attrs['class'] = "form-control"
if field.label: # pragma: no branch (currently all field are hidden or labeled) if isinstance(field.widget, (widgets.Input, widgets.Textarea)) and field.label:
attrs["placeholder"] = field.label attrs["placeholder"] = field.label
if field.required: if field.required:
attrs["required"] = "required" attrs["required"] = "required"

View File

@ -1,5 +1,5 @@
{% load i18n %}{% load staticfiles %}<!DOCTYPE html> {% load i18n %}{% load staticfiles %}{% get_current_language as LANGUAGE_CODE %}<!DOCTYPE html>
<html{% if request.LANGUAGE_CODE %} lang="{{ request.LANGUAGE_CODE }}"{% endif %}> <html{% if LANGUAGE_CODE %} lang="{{LANGUAGE_CODE}}"{% endif %}>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge" /><![endif]--> <!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge" /><![endif]-->

View File

@ -11,6 +11,7 @@ https://docs.djangoproject.com/en/1.9/ref/settings/
""" """
import os import os
import django
# Build paths inside the project like this: os.path.join(BASE_DIR, ...) # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
@ -40,7 +41,7 @@ INSTALLED_APPS = [
'cas_server', 'cas_server',
] ]
MIDDLEWARE_CLASSES = [ MIDDLEWARE = [
'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware', 'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware', 'django.middleware.csrf.CsrfViewMiddleware',
@ -50,6 +51,8 @@ MIDDLEWARE_CLASSES = [
'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.locale.LocaleMiddleware', 'django.middleware.locale.LocaleMiddleware',
] ]
if django.VERSION < (1, 10):
MIDDLEWARE_CLASSES = MIDDLEWARE
TEMPLATES = [ TEMPLATES = [
{ {

View File

@ -1,4 +1,4 @@
Django >= 1.7.1,<1.10 Django >= 1.7.1,<1.11
setuptools>=5.5 setuptools>=5.5
requests>=2.4 requests>=2.4
requests_futures>=0.9.5 requests_futures>=0.9.5

View File

@ -34,6 +34,7 @@ if __name__ == '__main__':
'Framework :: Django :: 1.7', 'Framework :: Django :: 1.7',
'Framework :: Django :: 1.8', 'Framework :: Django :: 1.8',
'Framework :: Django :: 1.9', 'Framework :: Django :: 1.9',
'Framework :: Django :: 1.10',
'Intended Audience :: Developers', 'Intended Audience :: Developers',
'Intended Audience :: System Administrators', 'Intended Audience :: System Administrators',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)', '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'], keywords=['django', 'cas', 'cas3', 'server', 'sso', 'single sign-on', 'authentication', 'auth'],
install_requires=[ 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' 'lxml >= 3.4', 'six >= 1'
], ],
url="https://github.com/nitmir/django-cas-server", url="https://github.com/nitmir/django-cas-server",

23
tox.ini
View File

@ -5,11 +5,14 @@ envlist=
py27-django17, py27-django17,
py27-django18, py27-django18,
py27-django19, py27-django19,
py27-django110,
py34-django17, py34-django17,
py34-django18, py34-django18,
py34-django19, py34-django19,
py34-django110,
py35-django18, py35-django18,
py35-django19, py35-django19,
py35-django110,
[flake8] [flake8]
max-line-length=100 max-line-length=100
@ -53,6 +56,12 @@ deps =
Django>=1.9,<1.10 Django>=1.9,<1.10
{[base]deps} {[base]deps}
[testenv:py27-django110]
basepython=python2.7
deps =
Django>=1.10,<1.11
{[base]deps}
[testenv:py34-django17] [testenv:py34-django17]
basepython=python3.4 basepython=python3.4
deps = deps =
@ -71,6 +80,12 @@ deps =
Django>=1.9,<1.10 Django>=1.9,<1.10
{[base]deps} {[base]deps}
[testenv:py34-django110]
basepython=python3.4
deps =
Django>=1.10,<1.11
{[base]deps}
[testenv:py35-django18] [testenv:py35-django18]
basepython=python3.5 basepython=python3.5
deps = deps =
@ -83,6 +98,12 @@ deps =
Django>=1.9,<1.10 Django>=1.9,<1.10
{[base]deps} {[base]deps}
[testenv:py35-django110]
basepython=python3.5
deps =
Django>=1.10,<1.11
{[base]deps}
[testenv:flake8] [testenv:flake8]
basepython=python basepython=python
@ -114,7 +135,7 @@ deps=
codacy-coverage codacy-coverage
skip_install=True skip_install=True
commands= 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 python-codacy-coverage -r {toxinidir}/coverage.xml
{[post_cmd]commands} {[post_cmd]commands}
whitelist_externals={[post_cmd]whitelist_externals} whitelist_externals={[post_cmd]whitelist_externals}