diff --git a/.travis.yml b/.travis.yml index 95851aff0c873cf86b45e891684fb94b2ae72386..72dd00bb3069219432d0d59aac9035bc45516b5a 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 0f376d378b183a52ed25470b61b5eb3413364197..ec547dd61e71af8c93f431df8069c195693289bd 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 13f0b2081811b8e1c54503571c3bf95bff40fbf9..8f32b24f97f4c5cd8cabd796ee68ced61589eaaf 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 88ee99c847db1c3662e64ea3725a240bd8765bf9..ab72749ee6b89517e513a358d7a81db82589a36a 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 23b389c246ebbed86c5707a914c715316cca9bbf..30aacd42a0f975b0d519dd68c15bfeebc209dd6d 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 d3781479026b8ea710a0e8db6f9840acdb303b3a..9fe9d01bff757931e9456076d6088c37a874555a 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',