[Checkins] SVN: ldappas/trunk/ Use ZTK. Getting rid of zope.app.testing is more involved, and will
Martijn Faassen
faassen at startifact.com
Thu Dec 2 10:42:49 EST 2010
Log message for revision 118669:
Use ZTK. Getting rid of zope.app.testing is more involved, and will
have to wait.
Changed:
U ldappas/trunk/CHANGES.txt
U ldappas/trunk/src/ldappas/README.txt
U ldappas/trunk/src/ldappas/authentication.py
U ldappas/trunk/src/ldappas/tests.py
-=-
Modified: ldappas/trunk/CHANGES.txt
===================================================================
--- ldappas/trunk/CHANGES.txt 2010-12-02 15:09:03 UTC (rev 118668)
+++ ldappas/trunk/CHANGES.txt 2010-12-02 15:42:48 UTC (rev 118669)
@@ -2,10 +2,10 @@
ldappas changes
===============
-0.7.1 - (unreleased)
+0.8 - (unreleased)
====================
- * ...
+ * Changes to use the ZTK import locations.
0.7 - 04.07.2008
================
Modified: ldappas/trunk/src/ldappas/README.txt
===================================================================
--- ldappas/trunk/src/ldappas/README.txt 2010-12-02 15:09:03 UTC (rev 118668)
+++ ldappas/trunk/src/ldappas/README.txt 2010-12-02 15:42:48 UTC (rev 118669)
@@ -3,7 +3,7 @@
==========================
This is a plugin for the pluggable authentication utility (located at
-``zope.app.authentication``) to deal with LDAP principal sources. It depends
+``zope.pluggableauth``) to deal with LDAP principal sources. It depends
on the ``ldapadapter`` module (which itself depends on `python-ldap`).
Authentication and Search
@@ -218,7 +218,7 @@
authenticator utility:
>>> from zope.component import provideUtility
- >>> from zope.app.authentication.interfaces import IAuthenticatorPlugin
+ >>> from zope.pluggableauth.interfaces import IAuthenticatorPlugin
>>> provideUtility(auth, provides=IAuthenticatorPlugin,
... name='ldap-authenticator')
@@ -226,7 +226,7 @@
request:
>>> import zope.interface
- >>> from zope.app.authentication.interfaces import ICredentialsPlugin
+ >>> from zope.pluggableauth.interfaces import ICredentialsPlugin
>>> class MyCredentialsPlugin:
...
@@ -248,14 +248,14 @@
to register an adapter that can create principals from principal infos:
>>> from zope.component import provideAdapter
- >>> from zope.app.authentication import principalfolder
- >>> provideAdapter(principalfolder.AuthenticatedPrincipalFactory)
+ >>> from zope.pluggableauth import factories
+ >>> provideAdapter(factories.AuthenticatedPrincipalFactory)
We are finally ready to create a pluggable authentication utility and register
the two plugins with it:
- >>> from zope.app import authentication
- >>> pau = authentication.PluggableAuthentication('pau.')
+ >>> from zope import pluggableauth
+ >>> pau = pluggableauth.PluggableAuthentication('pau.')
>>> pau.credentialsPlugins = ('simple-creds', )
>>> pau.authenticatorPlugins = ('ldap-authenticator', )
@@ -271,7 +271,7 @@
You can also ask the authentication utility about a particular principal, once
you have its id:
- >>> provideAdapter(principalfolder.FoundPrincipalFactory)
+ >>> provideAdapter(factories.FoundPrincipalFactory)
>>> pau.getPrincipal(u'pau.ldap.ok')
Principal(u'pau.ldap.ok')
Modified: ldappas/trunk/src/ldappas/authentication.py
===================================================================
--- ldappas/trunk/src/ldappas/authentication.py 2010-12-02 15:09:03 UTC (rev 118668)
+++ ldappas/trunk/src/ldappas/authentication.py 2010-12-02 15:42:48 UTC (rev 118669)
@@ -18,10 +18,10 @@
import zope.schema
import zope.interface
from persistent import Persistent
+from zope import component
-from zope.app import zapi
-from zope.app import authentication
-from zope.app.container.contained import Contained
+from zope import pluggableauth
+from zope.container.contained import Contained
from ldap.filter import filter_format
from ldapadapter.interfaces import ServerDown
@@ -53,7 +53,7 @@
class PrincipalInfo:
"""An implementation of IPrincipalInfo used by the principal folder."""
- zope.interface.implements(authentication.interfaces.IPrincipalInfo)
+ zope.interface.implements(pluggableauth.interfaces.IPrincipalInfo)
def __init__(self, id, login='', title='', description=''):
self.id = id
@@ -75,9 +75,9 @@
zope.interface.implements(
ILDAPAuthentication,
- authentication.interfaces.IAuthenticatorPlugin,
- authentication.interfaces.IQueriableAuthenticator,
- authentication.interfaces.IQuerySchemaSearch)
+ pluggableauth.interfaces.IAuthenticatorPlugin,
+ pluggableauth.interfaces.IQueriableAuthenticator,
+ pluggableauth.interfaces.IQuerySchemaSearch)
adapterName = ''
searchBase = ''
@@ -97,11 +97,11 @@
Returns None if adapter connection is configured or available.
"""
- da = zapi.queryUtility(ILDAPAdapter, self.adapterName)
+ da = component.queryUtility(ILDAPAdapter, name=self.adapterName)
return da
def authenticateCredentials(self, credentials):
- """See zope.app.authentication.interfaces.IAuthenticatorPlugin."""
+ """See zope.pluggableauth.interfaces.IAuthenticatorPlugin."""
if not isinstance(credentials, dict):
return None
@@ -149,7 +149,7 @@
return PrincipalInfo(id, **self.getInfoFromEntry(dn, entry))
def principalInfo(self, id):
- """See zope.app.authentication.interfaces.IAuthenticatorPlugin."""
+ """See zope.pluggableauth.interfaces.IAuthenticatorPlugin."""
if not id.startswith(self.principalIdPrefix):
return None
internal_id = id[len(self.principalIdPrefix):]
@@ -204,7 +204,7 @@
}
def search(self, query, start=None, batch_size=None):
- """See zope.app.authentication.interfaces.IQuerySchemaSearch."""
+ """See zope.pluggableauth.interfaces.IQuerySchemaSearch."""
da = self.getLDAPAdapter()
if da is None:
return ()
Modified: ldappas/trunk/src/ldappas/tests.py
===================================================================
--- ldappas/trunk/src/ldappas/tests.py 2010-12-02 15:09:03 UTC (rev 118668)
+++ ldappas/trunk/src/ldappas/tests.py 2010-12-02 15:42:48 UTC (rev 118669)
@@ -15,12 +15,12 @@
$Id$
"""
-import unittest
+import unittest, doctest
import zope.interface
-from zope.testing import doctest, doctestunit
-from zope.app import zapi
+
from zope.app.testing import setup
+from pprint import pprint
import ldapadapter.interfaces
@@ -95,7 +95,7 @@
return unittest.TestSuite((
doctest.DocFileSuite('README.txt',
setUp=setUp, tearDown=tearDown,
- globs={'pprint': doctestunit.pprint},
+ globs={'pprint': pprint},
optionflags=doctest.NORMALIZE_WHITESPACE),
))
More information about the checkins
mailing list