browser.loops.auth: Python3 fix

This commit is contained in:
Helmut Merz 2024-09-25 17:05:19 +02:00
parent 52e3fc72c6
commit 17fbeb2c2c
2 changed files with 10 additions and 28 deletions

View file

@ -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

View file

@ -21,6 +21,7 @@ dependencies = [
"zope.app.container",
"zope.app.file",
"zope.app.rotterdam",
"zope.app.security",
"zope.app.testing",
"zope.authentication",
"zope.browser",