[Checkins] SVN: zope.authentication/trunk/ Drop zope.publisher dependency. The ILoginPassword adapters will be moved to zope.publisher.

Dan Korostelev nadako at gmail.com
Fri Mar 13 04:59:34 EDT 2009


Log message for revision 98021:
  Drop zope.publisher dependency. The ILoginPassword adapters will be moved to zope.publisher.

Changed:
  U   zope.authentication/trunk/buildout.cfg
  U   zope.authentication/trunk/setup.py
  D   zope.authentication/trunk/src/zope/authentication/basicauthadapter.py
  U   zope.authentication/trunk/src/zope/authentication/configure.zcml
  D   zope.authentication/trunk/src/zope/authentication/ftpauth.py
  D   zope.authentication/trunk/src/zope/authentication/tests/test_basicauthadapter.py
  D   zope.authentication/trunk/src/zope/authentication/tests/test_ftpauth.py
  U   zope.authentication/trunk/src/zope/authentication/tests/test_logout.py

-=-
Modified: zope.authentication/trunk/buildout.cfg
===================================================================
--- zope.authentication/trunk/buildout.cfg	2009-03-13 07:24:32 UTC (rev 98020)
+++ zope.authentication/trunk/buildout.cfg	2009-03-13 08:59:34 UTC (rev 98021)
@@ -1,5 +1,5 @@
 [buildout]
-develop = . ../zope.component
+develop = .
 parts = test coverage-test coverage-report
 
 [test]

Modified: zope.authentication/trunk/setup.py
===================================================================
--- zope.authentication/trunk/setup.py	2009-03-13 07:24:32 UTC (rev 98020)
+++ zope.authentication/trunk/setup.py	2009-03-13 08:59:34 UTC (rev 98021)
@@ -56,14 +56,11 @@
       namespace_packages=['zope'],
       install_requires=['setuptools',
                         'zope.browser',
-                        'zope.component',
+                        'zope.component>=3.6.0',
                         'zope.i18nmessageid',
                         'zope.interface',
                         'zope.schema',
-                        
-                        'zope.publisher', # XXX: this is for ILoginPassword
-                                          # adapters that should be moved
-                                          # elsewhere, probably to zope.publisher
+                        'zope.security',
                         ],
       include_package_data = True,
       zip_safe = False,

Deleted: zope.authentication/trunk/src/zope/authentication/basicauthadapter.py
===================================================================
--- zope.authentication/trunk/src/zope/authentication/basicauthadapter.py	2009-03-13 07:24:32 UTC (rev 98020)
+++ zope.authentication/trunk/src/zope/authentication/basicauthadapter.py	2009-03-13 08:59:34 UTC (rev 98021)
@@ -1,40 +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.
-#
-##############################################################################
-"""HTTP Basic Authentication adapter
-
-$Id$
-"""
-from zope.component import adapts
-from zope.publisher.interfaces.http import IHTTPCredentials
-
-from zope.authentication.loginpassword import LoginPassword
-
-
-class BasicAuthAdapter(LoginPassword):
-    """Adapter for handling HTTP Basic Auth."""
-
-    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)

Modified: zope.authentication/trunk/src/zope/authentication/configure.zcml
===================================================================
--- zope.authentication/trunk/src/zope/authentication/configure.zcml	2009-03-13 07:24:32 UTC (rev 98020)
+++ zope.authentication/trunk/src/zope/authentication/configure.zcml	2009-03-13 08:59:34 UTC (rev 98021)
@@ -1,22 +1,6 @@
-<configure
-    xmlns="http://namespaces.zope.org/zope"
-    i18n_domain="zope"
-    >
+<configure xmlns="http://namespaces.zope.org/zope">
 
   <adapter factory=".logout.NoLogout" />
-
-  <adapter
-      factory=".basicauthadapter.BasicAuthAdapter"
-      provides=".interfaces.ILoginPassword"
-      for="zope.publisher.interfaces.http.IHTTPCredentials"
-      />
-
-  <adapter
-      factory=".ftpauth.FTPAuth"
-      provides=".interfaces.ILoginPassword"
-      for="zope.publisher.interfaces.ftp.IFTPCredentials"
-      />
-
   <adapter factory=".principal.PrincipalTerms" />
 
 </configure>

Deleted: zope.authentication/trunk/src/zope/authentication/ftpauth.py
===================================================================
--- zope.authentication/trunk/src/zope/authentication/ftpauth.py	2009-03-13 07:24:32 UTC (rev 98020)
+++ zope.authentication/trunk/src/zope/authentication/ftpauth.py	2009-03-13 08:59:34 UTC (rev 98021)
@@ -1,38 +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.
-#
-##############################################################################
-"""FTP Standard Authentication adapter
-
-$Id$
-"""
-from zope.component import adapts
-from zope.publisher.interfaces.ftp import IFTPCredentials
-
-from zope.authentication.loginpassword import LoginPassword
-
-class FTPAuth(LoginPassword):
-    """Adapter for handling common FTP authentication."""
-
-    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")

Deleted: zope.authentication/trunk/src/zope/authentication/tests/test_basicauthadapter.py
===================================================================
--- zope.authentication/trunk/src/zope/authentication/tests/test_basicauthadapter.py	2009-03-13 07:24:32 UTC (rev 98020)
+++ zope.authentication/trunk/src/zope/authentication/tests/test_basicauthadapter.py	2009-03-13 08:59:34 UTC (rev 98021)
@@ -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.authentication.basicauthadapter 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.authentication/trunk/src/zope/authentication/tests/test_ftpauth.py
===================================================================
--- zope.authentication/trunk/src/zope/authentication/tests/test_ftpauth.py	2009-03-13 07:24:32 UTC (rev 98020)
+++ zope.authentication/trunk/src/zope/authentication/tests/test_ftpauth.py	2009-03-13 08:59:34 UTC (rev 98021)
@@ -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.authentication.ftpauth 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')

Modified: zope.authentication/trunk/src/zope/authentication/tests/test_logout.py
===================================================================
--- zope.authentication/trunk/src/zope/authentication/tests/test_logout.py	2009-03-13 07:24:32 UTC (rev 98020)
+++ zope.authentication/trunk/src/zope/authentication/tests/test_logout.py	2009-03-13 08:59:34 UTC (rev 98021)
@@ -19,7 +19,6 @@
 
 from zope.component import provideAdapter, adapts
 from zope.interface import implements
-from zope.publisher.tests.httprequest import TestRequest
 
 from zope.authentication.interfaces import IAuthentication
 
@@ -29,7 +28,7 @@
         doctest.DocFileSuite(
             '../logout.txt',
             globs={'provideAdapter': provideAdapter,
-                   'TestRequest': TestRequest,
+                   'TestRequest': object,
                    'implements': implements,
                    'adapts': adapts,
                    'IAuthentication': IAuthentication



More information about the Checkins mailing list