Skip to content
Snippets Groups Projects
Commit b2c0d103 authored by admiralobvious's avatar admiralobvious
Browse files

drop support for python 2.7

parent 687fbb53
Branches
No related tags found
No related merge requests found
......@@ -2,7 +2,6 @@ language: python
sudo: required
dist: xenial
python:
- "2.7"
- "3.5"
- "3.6"
- "3.7"
......
......@@ -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:
......
......@@ -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.
......
......@@ -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:
......
# -*- 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,10 +233,6 @@ 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]
return groups
......@@ -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))
......
......@@ -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',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment