[Checkins] SVN: zope.publisher/trunk/ Reverted change done in 3.6.2. The zope.authentication dependency has been removed again. The BasicAuthAdapter and FTPAuth adapters are now found in the new zope.login package.

Hanno Schlichting hannosch at hannosch.eu
Thu Dec 31 12:11:48 EST 2009


Log message for revision 107460:
  Reverted change done in 3.6.2. The zope.authentication dependency has been removed again. The BasicAuthAdapter and FTPAuth adapters are now found in the new zope.login package.
  

Changed:
  U   zope.publisher/trunk/CHANGES.txt
  U   zope.publisher/trunk/setup.py
  U   zope.publisher/trunk/src/zope/publisher/configure.zcml
  U   zope.publisher/trunk/src/zope/publisher/ftp.py
  U   zope.publisher/trunk/src/zope/publisher/http.py
  D   zope.publisher/trunk/src/zope/publisher/tests/test_basicauthadapter.py
  D   zope.publisher/trunk/src/zope/publisher/tests/test_ftpauth.py

-=-
Modified: zope.publisher/trunk/CHANGES.txt
===================================================================
--- zope.publisher/trunk/CHANGES.txt	2009-12-31 17:02:56 UTC (rev 107459)
+++ zope.publisher/trunk/CHANGES.txt	2009-12-31 17:11:48 UTC (rev 107460)
@@ -1,9 +1,12 @@
 CHANGES
 =======
 
-3.11.1 (unreleased)
+3.12.0 (unreleased)
 -------------------
 
+- Reverted change done in 3.6.2. The zope.authentication dependency has been
+  removed again. The BasicAuthAdapter and FTPAuth adapters are now found in
+  the new zope.login package.
 
 3.11.0 (2009-12-15)
 -------------------

Modified: zope.publisher/trunk/setup.py
===================================================================
--- zope.publisher/trunk/setup.py	2009-12-31 17:02:56 UTC (rev 107459)
+++ zope.publisher/trunk/setup.py	2009-12-31 17:11:48 UTC (rev 107460)
@@ -28,7 +28,7 @@
 """
 
 setup(name='zope.publisher',
-      version = '3.11.1dev',
+      version = '3.12.0dev',
       url='http://pypi.python.org/pypi/zope.publisher',
       license='ZPL 2.1',
       author='Zope Corporation and Contributors',
@@ -46,7 +46,6 @@
       namespace_packages=['zope',],
       tests_require=['zope.testing'],
       install_requires=['setuptools',
-                        'zope.authentication',
                         'zope.browser',
                         'zope.component',
                         'zope.configuration',

Modified: zope.publisher/trunk/src/zope/publisher/configure.zcml
===================================================================
--- zope.publisher/trunk/src/zope/publisher/configure.zcml	2009-12-31 17:02:56 UTC (rev 107459)
+++ zope.publisher/trunk/src/zope/publisher/configure.zcml	2009-12-31 17:11:48 UTC (rev 107460)
@@ -90,18 +90,6 @@
       for="zope.security.interfaces.IPrincipal"
       />
 
-  <adapter
-      factory=".http.BasicAuthAdapter"
-      provides="zope.authentication.interfaces.ILoginPassword"
-      for=".interfaces.http.IHTTPCredentials"
-      />
-
-  <adapter
-      factory=".ftp.FTPAuth"
-      provides="zope.authentication.interfaces.ILoginPassword"
-      for=".interfaces.ftp.IFTPCredentials"
-      />
-
   <apidoc:bookchapter
       zcml:condition="have apidoc"
       id="zopepublisherhttpresults.txt"

Modified: zope.publisher/trunk/src/zope/publisher/ftp.py
===================================================================
--- zope.publisher/trunk/src/zope/publisher/ftp.py	2009-12-31 17:02:56 UTC (rev 107459)
+++ zope.publisher/trunk/src/zope/publisher/ftp.py	2009-12-31 17:11:48 UTC (rev 107460)
@@ -15,8 +15,6 @@
 
 $Id$
 """
-from zope.authentication.loginpassword import LoginPassword
-from zope.component import adapts
 from zope.interface import implements
 from zope.publisher.interfaces.ftp import IFTPCredentials, IFTPRequest
 from zope.publisher.base import BaseResponse, BaseRequest
@@ -71,23 +69,8 @@
         'See IFTPCredentials'
 
 
-class FTPAuth(LoginPassword):
-    """ILoginPassword adapter for handling common FTP authentication."""
-
-    # This was moved from zope.app.security as a part of refactoring process,
-    # see http://mail.zope.org/pipermail/zope-dev/2009-March/035325.html for
-    # the reasoning.
-
-    adapts(IFTPCredentials)
-
-    def __init__(self, request):
-        self.__request = request
-        lpw = request._authUserPW()
-        if lpw is None:
-            login, password = None, None
-        else:
-            login, password = lpw
-        super(FTPAuth, self).__init__(login, password)
-
-    def needLogin(self, realm):
-        self.__request.unauthorized("Did not work")
+# BBB
+try:
+    from zope.login.ftp import FTPAuth
+except ImportError:
+    pass

Modified: zope.publisher/trunk/src/zope/publisher/http.py
===================================================================
--- zope.publisher/trunk/src/zope/publisher/http.py	2009-12-31 17:02:56 UTC (rev 107459)
+++ zope.publisher/trunk/src/zope/publisher/http.py	2009-12-31 17:11:48 UTC (rev 107460)
@@ -16,7 +16,6 @@
 $Id$
 """
 from cStringIO import StringIO
-from zope.authentication.loginpassword import LoginPassword
 from zope.i18n.interfaces import IUserPreferredCharsets
 from zope.i18n.interfaces import IUserPreferredLanguages
 from zope.i18n.locales import locales, LoadLocaleError
@@ -1037,24 +1036,8 @@
         return iter(self.body)
 
 
-class BasicAuthAdapter(LoginPassword):
-    """ILoginPassword adapter for handling HTTP Basic authentication"""
-
-    # This was moved from zope.app.security as a part of refactoring process,
-    # see http://mail.zope.org/pipermail/zope-dev/2009-March/035325.html for
-    # the reasoning.
-
-    zope.component.adapts(IHTTPCredentials)
-
-    def __init__(self, request):
-        self.__request = request
-        # TODO base64 decoding should be done here, not in request
-        lpw = request._authUserPW()
-        if lpw is None:
-            login, password = None, None
-        else:
-            login, password = lpw
-        super(BasicAuthAdapter, self).__init__(login, password)
-
-    def needLogin(self, realm):
-        self.__request.unauthorized('basic realm="%s"' % realm)
+# BBB
+try:
+    from zope.login.http import BasicAuthAdapter
+except ImportError:
+    pass

Deleted: zope.publisher/trunk/src/zope/publisher/tests/test_basicauthadapter.py
===================================================================
--- zope.publisher/trunk/src/zope/publisher/tests/test_basicauthadapter.py	2009-12-31 17:02:56 UTC (rev 107459)
+++ zope.publisher/trunk/src/zope/publisher/tests/test_basicauthadapter.py	2009-12-31 17:11:48 UTC (rev 107460)
@@ -1,58 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Test Basic Authentication Adapter
-
-$Id$
-"""
-import unittest
-
-from zope.publisher.http import BasicAuthAdapter
-
-class Request(object):
-
-    def __init__(self, lpw):
-        self.lpw = lpw
-
-    def _authUserPW(self):
-        return self.lpw
-
-    challenge = None
-    def unauthorized(self, challenge):
-        self.challenge = challenge
-
-
-class Test(unittest.TestCase):
-
-    def testBasicAuthAdapter(self):
-        r = Request(None)
-        a = BasicAuthAdapter(r)
-        self.assertEqual(a.getLogin(), None)
-        self.assertEqual(a.getPassword(), None)
-        r = Request(("tim", "123"))
-        a = BasicAuthAdapter(r)
-        self.assertEqual(a.getLogin(), "tim")
-        self.assertEqual(a.getPassword(), "123")
-
-    def testUnauthorized(self):
-        r = Request(None)
-        a = BasicAuthAdapter(r)
-        a.needLogin("tim")
-        self.assertEqual(r.challenge, 'basic realm="tim"')
-
-def test_suite():
-    loader=unittest.TestLoader()
-    return loader.loadTestsFromTestCase(Test)
-
-if __name__=='__main__':
-    unittest.TextTestRunner().run(test_suite())

Deleted: zope.publisher/trunk/src/zope/publisher/tests/test_ftpauth.py
===================================================================
--- zope.publisher/trunk/src/zope/publisher/tests/test_ftpauth.py	2009-12-31 17:02:56 UTC (rev 107459)
+++ zope.publisher/trunk/src/zope/publisher/tests/test_ftpauth.py	2009-12-31 17:11:48 UTC (rev 107460)
@@ -1,63 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2003 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""FTP Authentication Test
-
-$Id$
-"""
-from unittest import TestCase, TestSuite, main, makeSuite
-from zope.publisher.interfaces.ftp import IFTPCredentials
-from zope.interface import implements
-
-from zope.publisher.ftp import FTPAuth
-
-class FTPCredentials(object):
-    __doc__ = IFTPCredentials.__doc__
-
-    implements(IFTPCredentials)
-
-    def __init__(self, credentials):
-        self.credentials = credentials
-
-    def _authUserPW(self):
-        return self.credentials
-
-    unauth = 0
-    def unauthorized(self, challenge):
-        self.unauth += 1
-
-
-class Test(TestCase):
-
-    def test(self):
-        request = FTPCredentials(('bob', '123'))
-        auth = FTPAuth(request)
-        self.assertEqual(auth.getLogin(), 'bob')
-        self.assertEqual(auth.getPassword(), '123')
-
-        unauth = request.unauth
-        auth.needLogin('xxx')
-        self.assertEqual(request.unauth, unauth+1)
-
-        request = FTPCredentials(None)
-        auth = FTPAuth(request)
-        self.assertEqual(auth.getLogin(), None)
-        self.assertEqual(auth.getPassword(), None)
-
-def test_suite():
-    return TestSuite((
-        makeSuite(Test),
-        ))
-
-if __name__=='__main__':
-    main(defaultTest='test_suite')



More information about the checkins mailing list