diff options
author | Ben Sturmfels <ben@sturm.com.au> | 2021-03-05 23:12:19 +1100 |
---|---|---|
committer | Ben Sturmfels <ben@sturm.com.au> | 2021-03-05 23:12:19 +1100 |
commit | dec47c7102cf0aa3a4debf002928db8e460c0d71 (patch) | |
tree | 47631fc15c7af172aa699506adf3d76d3a71976c /mediagoblin/plugins/ldap | |
parent | 5f3a782fef4855e10b7259624a14d8afb0f7be93 (diff) | |
download | mediagoblin-dec47c7102cf0aa3a4debf002928db8e460c0d71.tar.lz mediagoblin-dec47c7102cf0aa3a4debf002928db8e460c0d71.tar.xz mediagoblin-dec47c7102cf0aa3a4debf002928db8e460c0d71.zip |
Apply `pyupgrade --py3-plus` to remove Python 2 compatibility code.
Diffstat (limited to 'mediagoblin/plugins/ldap')
-rw-r--r-- | mediagoblin/plugins/ldap/tools.py | 10 | ||||
-rw-r--r-- | mediagoblin/plugins/ldap/views.py | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/mediagoblin/plugins/ldap/tools.py b/mediagoblin/plugins/ldap/tools.py index 9d6d8b2a..89ac8c11 100644 --- a/mediagoblin/plugins/ldap/tools.py +++ b/mediagoblin/plugins/ldap/tools.py @@ -23,12 +23,12 @@ from mediagoblin.tools import pluginapi _log = logging.getLogger(__name__) -class LDAP(object): +class LDAP: def __init__(self): self.ldap_settings = pluginapi.get_config('mediagoblin.plugins.ldap') def _connect(self, server): - _log.info('Connecting to {0}.'.format(server['LDAP_SERVER_URI'])) + _log.info('Connecting to {}.'.format(server['LDAP_SERVER_URI'])) self.conn = ldap.initialize(server['LDAP_SERVER_URI']) if server['LDAP_START_TLS'] == 'true': @@ -38,7 +38,7 @@ class LDAP(object): def _get_email(self, server, username): try: results = self.conn.search_s(server['LDAP_SEARCH_BASE'], - ldap.SCOPE_SUBTREE, 'uid={0}' + ldap.SCOPE_SUBTREE, 'uid={}' .format(username), [server['EMAIL_SEARCH_FIELD']]) @@ -49,7 +49,7 @@ class LDAP(object): return email def login(self, username, password): - for k, v in six.iteritems(self.ldap_settings): + for k, v in self.ldap_settings.items(): try: self._connect(v) user_dn = v['LDAP_USER_DN_TEMPLATE'].format(username=username) @@ -61,7 +61,7 @@ class LDAP(object): _log.info(e) finally: - _log.info('Unbinding {0}.'.format(v['LDAP_SERVER_URI'])) + _log.info('Unbinding {}.'.format(v['LDAP_SERVER_URI'])) self.conn.unbind() return False, None diff --git a/mediagoblin/plugins/ldap/views.py b/mediagoblin/plugins/ldap/views.py index e10c7f60..99ecb456 100644 --- a/mediagoblin/plugins/ldap/views.py +++ b/mediagoblin/plugins/ldap/views.py @@ -44,7 +44,7 @@ def login(request): if user: # set up login in session - request.session['user_id'] = six.text_type(user.id) + request.session['user_id'] = str(user.id) request.session.save() if request.form.get('next'): |