From 72b6e24df70146e5784ebcbeff4c75e6e10ed0b9 Mon Sep 17 00:00:00 2001 From: Kevin McElwee Date: Thu, 20 Aug 2020 17:32:05 -0400 Subject: [PATCH 01/13] update version to 0.8-dev --- pucas/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pucas/__init__.py b/pucas/__init__.py index 9397b33..45c6091 100644 --- a/pucas/__init__.py +++ b/pucas/__init__.py @@ -1,6 +1,6 @@ default_app_config = 'pucas.apps.PucasConfig' -__version_info__ = (0, 7, 0) +__version_info__ = (0, 8, 0, 'dev') # Dot-connect all but the last. Last is dash-connected if not None. __version__ = '.'.join([str(i) for i in __version_info__[:-1]]) From 34bf710c720e2d60fb4bf51048be26aac9cb94b6 Mon Sep 17 00:00:00 2001 From: rlskoeser Date: Tue, 25 Aug 2020 10:51:05 -0400 Subject: [PATCH 02/13] Document that *main* is now primary production branch for this project --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 6e63674..60c84f8 100644 --- a/README.rst +++ b/README.rst @@ -151,7 +151,7 @@ Two manage commands are provided, for convenience. Development instructions ------------------------ -This git repository uses git flow branching conventions. +This git repository uses git flow branching conventions, with **main** as the current production release branch. Initial setup and installation: From 4a9407291a2f90b57ce7621f6155cb853219cea6 Mon Sep 17 00:00:00 2001 From: rlskoeser Date: Tue, 25 Aug 2020 10:51:55 -0400 Subject: [PATCH 03/13] Drop testing on django 1.8-1.10; add django 3.0, 3.1 --- .travis.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 32006f5..62541d8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,13 +8,12 @@ python: - "3.7" env: - - DJANGO=1.8 - - DJANGO=1.9 - - DJANGO=1.10 - DJANGO=1.11 - DJANGO=2.0 - DJANGO=2.1 - DJANGO=2.2 + - DJANGO=3.0 + - DJANGO=3.1 before_install: - pip install --upgrade pytest From f446465eacc4d3a38da9da28dcf9014caff82200 Mon Sep 17 00:00:00 2001 From: rlskoeser Date: Tue, 25 Aug 2020 10:52:26 -0400 Subject: [PATCH 04/13] Use python3 StringIO import --- pucas/tests.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pucas/tests.py b/pucas/tests.py index 6dec2ac..69e1241 100644 --- a/pucas/tests.py +++ b/pucas/tests.py @@ -1,15 +1,16 @@ +from io import StringIO from unittest import mock + from django.conf import settings from django.core.management import call_command from django.test import TestCase, override_settings -from django.utils.six import StringIO -from ldap3.core.exceptions import LDAPException, LDAPCursorError +from ldap3.core.exceptions import LDAPCursorError, LDAPException import pytest from pucas.ldap import LDAPSearch, LDAPSearchException, \ user_info_from_ldap +from pucas.management.commands import createcasuser, ldapsearch from pucas.signals import cas_login -from pucas.management.commands import ldapsearch, createcasuser class MockLDAPInfo(object): @@ -17,12 +18,14 @@ class MockLDAPInfo(object): def __init__(self, **kwargs): for k, v in kwargs.items(): setattr(self, k, v) + def __getattr__(self, attr): # __getattr__ only gets called when the default attribute access # falls through, so in this case, we always want that to raise the # cursor error raise LDAPCursorError + class TestMockLDAPInfo(TestCase): def test_init(self): From cecf2a759b5893453225726202c62e40db934b05 Mon Sep 17 00:00:00 2001 From: rlskoeser Date: Tue, 25 Aug 2020 10:53:31 -0400 Subject: [PATCH 05/13] Add python 3 only classification Resolves #8 --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index 04b787d..87ece07 100644 --- a/setup.py +++ b/setup.py @@ -50,6 +50,7 @@ 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3 :: Only', 'Topic :: Internet :: WWW/HTTP', 'Topic :: System :: Systems Administration :: Authentication/Directory', 'Topic :: System :: Systems Administration :: Authentication/Directory :: LDAP', From 55bf75b9bb5a350ca80a134818aaefe4073da6b0 Mon Sep 17 00:00:00 2001 From: rlskoeser Date: Tue, 25 Aug 2020 11:14:12 -0400 Subject: [PATCH 06/13] Update testing matrix to drop py3.5 for django 3.x; add py3.8 --- .travis.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.travis.yml b/.travis.yml index 62541d8..9e584b9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ python: - "3.5" - "3.6" - "3.7" + - "3.8" env: - DJANGO=1.11 @@ -15,6 +16,13 @@ env: - DJANGO=3.0 - DJANGO=3.1 +matrix: + exclude: + - python: "3.5" + env: DJANGO=3.0 + - python: "3.5" + env: DJANGO=3.1 + before_install: - pip install --upgrade pytest From 3ae0181226486f0ecaaa7de7963b8827a787322c Mon Sep 17 00:00:00 2001 From: rlskoeser Date: Tue, 25 Aug 2020 11:20:10 -0400 Subject: [PATCH 07/13] Update python/django versions in readme & package classification --- README.rst | 9 ++++----- setup.py | 6 +++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/README.rst b/README.rst index 60c84f8..2667277 100644 --- a/README.rst +++ b/README.rst @@ -27,10 +27,10 @@ support for prepopulating user account data based on an LDAP search. .. _Django: https://www.djangoproject.com/ .. _django-cas-ng: https://github.com/mingchen/django-cas-ng -**django-pucas** is tested under: +**django-pucas** is tested against: -* Django ``1.8-2.2`` -* Python ``3.5-3.7`` +* Django ``1.11-3.1`` +* Python ``3.5-3.8`` **django-pucas** requires **django-cas-ng** 3.6 or greater. @@ -129,8 +129,7 @@ An example of a login template with local branding is provided at ``pucas/templates/pucas/sample-pu-login.html`` using re-usable template snippets that can be adapted or re-used as appropriate. -For Django 1.8, you will need to override ``admin/login.html`` as a whole, as -extending the login template with itself causes a recursion error. +Note that login templates have not yet been updated for Django 3.x. Usage ----- diff --git a/setup.py b/setup.py index 04b787d..099cfd1 100644 --- a/setup.py +++ b/setup.py @@ -35,13 +35,12 @@ classifiers=[ 'Environment :: Web Environment', 'Framework :: Django', - 'Framework :: Django :: 1.8', - 'Framework :: Django :: 1.9', - 'Framework :: Django :: 1.10', 'Framework :: Django :: 1.11', 'Framework :: Django :: 2.0', 'Framework :: Django :: 2.1', 'Framework :: Django :: 2.2', + 'Framework :: Django :: 3.0', + 'Framework :: Django :: 3.1', 'Intended Audience :: Developers', 'License :: OSI Approved :: Apache Software License', 'Operating System :: OS Independent', @@ -50,6 +49,7 @@ 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', 'Topic :: Internet :: WWW/HTTP', 'Topic :: System :: Systems Administration :: Authentication/Directory', 'Topic :: System :: Systems Administration :: Authentication/Directory :: LDAP', From 1aaafffa77613a6120dbf17227eba679ea664dc4 Mon Sep 17 00:00:00 2001 From: rlskoeser Date: Tue, 25 Aug 2020 11:23:43 -0400 Subject: [PATCH 08/13] Document django/python version testing changes --- CHANGELOG.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 3f1090d..e92b7b7 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,6 +4,9 @@ CHANGELOG 0.7 ---- * Drop support for Python 2.7 +* No longer tested against Django 1.8-1.11; now tested against 3.0 and 3.1 +* Add testing for Python 3.8 +* Default branch name for current release is now **main** 0.6 ----- From f7d4334cab732f1aec3ca839dc2a4ffe1f159e4b Mon Sep 17 00:00:00 2001 From: rlskoeser Date: Tue, 25 Aug 2020 11:27:34 -0400 Subject: [PATCH 09/13] Remove django 1.8 workaround no longer needed --- pucas/management/commands/createcasuser.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/pucas/management/commands/createcasuser.py b/pucas/management/commands/createcasuser.py index f1693ad..0600f20 100644 --- a/pucas/management/commands/createcasuser.py +++ b/pucas/management/commands/createcasuser.py @@ -47,19 +47,11 @@ def handle(self, *args, **options): user.save() self.stdout.write( - self.style_success("%s user '%s'" \ + self.style.SUCCESS( + "%s user '%s'" % ('Created' if created else 'Updated', netid))) except LDAPSearchException: self.stderr.write( - self.style.ERROR("LDAP information for '%s' not found" \ - % netid)) - - def style_success(self, msg): - # workaround to support django 1.8 - style.SUCCESS - # only added in django 1.9 - if hasattr(self.style, 'SUCCESS'): - return self.style.SUCCESS(msg) - else: - return msg - + self.style.ERROR("LDAP information for '%s' not found" + % netid)) From f6bf1b660ce5376a723116eee57dfd59d10c8df9 Mon Sep 17 00:00:00 2001 From: rlskoeser Date: Tue, 25 Aug 2020 11:30:52 -0400 Subject: [PATCH 10/13] Convert readme link from markdown to rst --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 60c84f8..782c577 100644 --- a/README.rst +++ b/README.rst @@ -168,7 +168,7 @@ Initial setup and installation: Unit Testing ^^^^^^^^^^^^^ -Unit tests are written with [py.test](http://doc.pytest.org/) but use some +Unit tests are written with `py.test `_ but use some Django test classes for compatibility with django test suites. Running the tests requires a minimal settings file for Django required configurations. From d61c225e88cfdedba912e534d2542c2636c1ca20 Mon Sep 17 00:00:00 2001 From: rlskoeser Date: Tue, 25 Aug 2020 11:31:54 -0400 Subject: [PATCH 11/13] Add badges for python and django versions from pypi --- README.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.rst b/README.rst index 782c577..99a5723 100644 --- a/README.rst +++ b/README.rst @@ -17,6 +17,12 @@ django-pucas :target: https://requires.io/github/Princeton-CDH/django-pucas/requirements/?branch=master :alt: Requirements Status +.. image:: https://img.shields.io/pypi/pyversions/viapy + :alt: PyPI - Python Version + +.. image:: https://img.shields.io/pypi/djversions/viapy + :alt: PyPI - Django Version + **django-pucas** is a reusable `Django`_ application to simplify logging into a Django application with CAS using `django-cas-ng`_. Login and creation of user accounts is handled by django-cas-ng; pucas adds From cd700b1dfafb89f0f96b3b527fced5e5934657e0 Mon Sep 17 00:00:00 2001 From: rlskoeser Date: Tue, 25 Aug 2020 11:37:34 -0400 Subject: [PATCH 12/13] Correct the list of django versions dropped in this release --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e92b7b7..f817fec 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,7 +4,7 @@ CHANGELOG 0.7 ---- * Drop support for Python 2.7 -* No longer tested against Django 1.8-1.11; now tested against 3.0 and 3.1 +* No longer tested against Django 1.8-1.10; now tested against 3.0 and 3.1 * Add testing for Python 3.8 * Default branch name for current release is now **main** From 807f53f59e4e32b856bae0c333c44e7a5c0d44d6 Mon Sep 17 00:00:00 2001 From: rlskoeser Date: Mon, 31 Aug 2020 13:13:50 -0400 Subject: [PATCH 13/13] Set version to 0.7 final --- pucas/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pucas/__init__.py b/pucas/__init__.py index 45c6091..55e03fb 100644 --- a/pucas/__init__.py +++ b/pucas/__init__.py @@ -1,6 +1,6 @@ default_app_config = 'pucas.apps.PucasConfig' -__version_info__ = (0, 8, 0, 'dev') +__version_info__ = (0, 7, 0, None) # Dot-connect all but the last. Last is dash-connected if not None. __version__ = '.'.join([str(i) for i in __version_info__[:-1]])