From b2c0d10332d27db8b349753f89dceb7db520b7f2 Mon Sep 17 00:00:00 2001 From: admiralobvious <aferlandqc@gmail.com> Date: Mon, 15 Jul 2019 00:19:39 -0400 Subject: [PATCH] drop support for python 2.7 --- .travis.yml | 1 - README.md | 2 +- docs/conf.py | 4 ++-- docs/index.rst | 2 +- flask_simpleldap/__init__.py | 14 ++------------ setup.py | 3 +-- 6 files changed, 7 insertions(+), 19 deletions(-) diff --git a/.travis.yml b/.travis.yml index 95851af..72dd00b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,6 @@ language: python sudo: required dist: xenial python: - - "2.7" - "3.5" - "3.6" - "3.7" diff --git a/README.md b/README.md index 0f376d3..ec547dd 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ First, install Flask-SimpleLDAP: Flask-SimpleLDAP depends, and will install for you, recent versions of Flask (0.12.4 or later) and [pyldap](https://github.com/pyldap/pyldap). Flask-SimpleLDAP is compatible -with and tested on Python 2.7, 3.5, 3.6 and 3.7. +with and tested on Python 3.5, 3.6 and 3.7. Next, add a ``LDAP`` instance to your code and at least the three required configuration options: diff --git a/docs/conf.py b/docs/conf.py index 13f0b20..8f32b24 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -64,9 +64,9 @@ copyright = u'2019, Alexandre Ferland' # built documents. # # The short X.Y version. -version = '1.3.2' +version = '1.4.0' # The full version, including alpha/beta/rc tags. -release = '1.3.2' +release = '1.4.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/docs/index.rst b/docs/index.rst index 88ee99c..ab72749 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -20,7 +20,7 @@ First, install Flask-SimpleLDAP: Flask-SimpleLDAP depends, and will install for you, recent versions of Flask (0.12.4 or later) and pyldap. Flask-SimpleLDAP is compatible -with and tested on Python 2.7, 3.5, 3.6 and 3.7. +with and tested on Python 3.5, 3.6 and 3.7. Next, add a :class:`~flask_simpleldap.LDAP` to your code and at least the three required configuration options: diff --git a/flask_simpleldap/__init__.py b/flask_simpleldap/__init__.py index 23b389c..30aacd4 100644 --- a/flask_simpleldap/__init__.py +++ b/flask_simpleldap/__init__.py @@ -1,8 +1,6 @@ -# -*- coding: utf-8 -*- import re from functools import wraps import ldap -import sys from ldap import filter as ldap_filter from flask import abort, current_app, g, make_response, redirect, url_for, \ request @@ -235,12 +233,8 @@ class LDAP(object): if current_app.config['LDAP_OPENLDAP']: group_member_filter = \ current_app.config['LDAP_GROUP_MEMBER_FILTER_FIELD'] - if sys.version_info[0] > 2: - groups = [record[1][group_member_filter][0].decode( - 'utf-8') for record in records] - else: - groups = [record[1][group_member_filter][0] for - record in records] + groups = [record[1][group_member_filter][0] for + record in records] return groups else: if current_app.config['LDAP_USER_GROUPS_FIELD'] in \ @@ -249,8 +243,6 @@ class LDAP(object): current_app.config['LDAP_USER_GROUPS_FIELD']] result = [re.findall(b'(?:cn=|CN=)(.*?),', group)[0] for group in groups] - if sys.version_info[0] > 2: - result = [r.decode('utf-8') for r in result] return result except ldap.LDAPError as e: raise LDAPException(self.error(e.args)) @@ -275,8 +267,6 @@ class LDAP(object): records[0][1]: members = records[0][1][ current_app.config['LDAP_GROUP_MEMBERS_FIELD']] - if sys.version_info[0] > 2: - members = [m.decode('utf-8') for m in members] return members except ldap.LDAPError as e: raise LDAPException(self.error(e.args)) diff --git a/setup.py b/setup.py index d378147..9fe9d01 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ from setuptools import setup setup( name='Flask-SimpleLDAP', - version='1.3.2', + version='1.4.0', url='https://github.com/admiralobvious/flask-simpleldap', license='MIT', author='Alexandre Ferland', @@ -29,7 +29,6 @@ setup( 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', 'Operating System :: OS Independent', - 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', -- GitLab