From 17fbeb2c2c1e84475da37ad6e957fadcd1a5d2f5 Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Wed, 25 Sep 2024 17:05:19 +0200 Subject: [PATCH] browser.loops.auth: Python3 fix --- cybertools/browser/loops/auth.py | 37 ++++++++------------------------ pyproject.toml | 1 + 2 files changed, 10 insertions(+), 28 deletions(-) diff --git a/cybertools/browser/loops/auth.py b/cybertools/browser/loops/auth.py index b13b97c..06c8ce7 100644 --- a/cybertools/browser/loops/auth.py +++ b/cybertools/browser/loops/auth.py @@ -1,36 +1,17 @@ -# -# Copyright (c) 2011 Helmut Merz helmutm@cy55.de -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# +# cybertools.browser.loops.auth -""" -login, logout and similar stuff. - -$Id$ +""" login, logout and similar stuff. """ -import urllib -from zope.app.authentication.session import SessionCredentialsPlugin -from zope.app.component import hooks -from zope.app.i18n import ZopeMessageFactory as _ +from urllib.parse import urlencode from zope.app.security.browser.auth import LoginLogout as BaseLoginLogout -from zope.app.security.interfaces import IUnauthenticatedPrincipal -from zope.app.security.interfaces import ILogoutSupported +from zope.authentication.interfaces import IUnauthenticatedPrincipal +from zope.authentication.interfaces import ILogoutSupported from zope.cachedescriptors.property import Lazy +from zope.component import hooks from zope.i18n import translate +from zope.i18nmessageid import ZopeMessageFactory as _ +from zope.pluggableauth.plugins.session import SessionCredentialsPlugin from zope.publisher.interfaces.http import IHTTPRequest from zope.traversing.browser import absoluteURL @@ -51,7 +32,7 @@ class LoopsSessionCredentialsPlugin(SessionCredentialsPlugin): camefrom = '/'.join(camefrom.split('/')[:-1]) url = '%s/@@%s?%s' % (absoluteURL(site, request), self.loginpagename, - urllib.urlencode({'camefrom': camefrom})) + urlencode({'camefrom': camefrom})) request.response.redirect(url) return True diff --git a/pyproject.toml b/pyproject.toml index 74d3b02..6db949f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,6 +21,7 @@ dependencies = [ "zope.app.container", "zope.app.file", "zope.app.rotterdam", + "zope.app.security", "zope.app.testing", "zope.authentication", "zope.browser",