Skip to content

Commit

Permalink
drop support for python 2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
alexferl committed Jul 15, 2019
1 parent 687fbb5 commit b2c0d10
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 19 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ language: python
sudo: required
dist: xenial
python:
- "2.7"
- "3.5"
- "3.6"
- "3.7"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ def __getattr__(cls, name):
# 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.
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
14 changes: 2 additions & 12 deletions flask_simpleldap/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -235,12 +233,8 @@ def get_user_groups(self, user):
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 \
Expand All @@ -249,8 +243,6 @@ def get_user_groups(self, user):
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))
Expand All @@ -275,8 +267,6 @@ def get_group_members(self, group):
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))
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name='Flask-SimpleLDAP',
version='1.3.2',
version='1.4.0',
url='https://github.com/admiralobvious/flask-simpleldap',
license='MIT',
author='Alexandre Ferland',
Expand All @@ -29,7 +29,6 @@
'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',
Expand Down

0 comments on commit b2c0d10

Please sign in to comment.