[Zope-CVS] SVN: book/trunk/passwdauth/ Updated to reflect latest methods and APIs.

Stephan Richter srichter at cosmos.phy.tufts.edu
Mon Aug 16 18:32:48 EDT 2004


Log message for revision 27155:
  Updated to reflect latest methods and APIs.
  


Changed:
  U   book/trunk/passwdauth/__init__.py
  U   book/trunk/passwdauth/configure.zcml
  U   book/trunk/passwdauth/interfaces.py
  U   book/trunk/passwdauth/tests.py


-=-
Modified: book/trunk/passwdauth/__init__.py
===================================================================
--- book/trunk/passwdauth/__init__.py	2004-08-16 22:10:58 UTC (rev 27154)
+++ book/trunk/passwdauth/__init__.py	2004-08-16 22:32:47 UTC (rev 27155)
@@ -22,18 +22,23 @@
 
 import os
 from persistent import Persistent
+
+from zope.exceptions import NotFoundError
+from zope.interface import implements
+
 from zope.app.container.contained import Contained
 from zope.app.location import locate
 from zope.app.pluggableauth import SimplePrincipal
+from zope.app.pluggableauth.interfaces import IContainedPrincipalSource
 from zope.app.pluggableauth.interfaces import ILoginPasswordPrincipalSource
-from zope.exceptions import NotFoundError
-from zope.interface import implements
+
 from interfaces import IFileBasedPrincipalSource
 
 class PasswdPrincipalSource(Contained, Persistent):
     """A Principal Source for /etc/passwd-like files."""
 
-    implements(ILoginPasswordPrincipalSource, IFileBasedPrincipalSource)
+    implements(ILoginPasswordPrincipalSource, IFileBasedPrincipalSource,
+               IContainedPrincipalSource)
 
     def __init__(self, filename=''):
         self.filename = filename

Modified: book/trunk/passwdauth/configure.zcml
===================================================================
--- book/trunk/passwdauth/configure.zcml	2004-08-16 22:10:58 UTC (rev 27154)
+++ book/trunk/passwdauth/configure.zcml	2004-08-16 22:32:47 UTC (rev 27155)
@@ -6,27 +6,36 @@
 <content class=".PasswdPrincipalSource">
   <factory
       id="zope.app.principalsources.PasswdPrincipalSource"
-      permission="zope.ManageServices"/>
-  <allow interface=".interfaces.IFileBasedPrincipalSource"/>
+      />
+  <allow interface=".interfaces.IFileBasedPrincipalSource"
+      />
   <require
       permission="zope.ManageContent"
-      set_schema=".interfaces.IFileBasedPrincipalSource"/>
+      set_schema=".interfaces.IFileBasedPrincipalSource"
+      />
 </content>
 
 <browser:addform
     schema=".interfaces.IFileBasedPrincipalSource" 
     label="Add file-based Principal Source in /etc/passwd style" 
+    name="AddPasswdPrincipalSourceForm.html" 
     content_factory=".PasswdPrincipalSource" 
     arguments="filename" 
-    name="AddPasswdPrincipalSourceForm" 
-    menu="add_principal_source" title="/etc/passwd Principal Source" 
-    permission="zope.ManageContent" /> 
+    permission="zope.ManageContent" 
+    />
 
+<browser:addMenuItem
+    title="/etc/passwd Principal Source" 
+    class=".PasswdPrincipalSource"
+    view="AddPasswdPrincipalSourceForm.html"	
+    permission="zope.ManageServices"
+    />
+
 <browser:editform 
     schema=".interfaces.IFileBasedPrincipalSource" 
     label="Edit file-based Principal Source" 
     name="edit.html"        
     menu="zmi_views" title="Edit" 
-    permission="zope.ManageContent" /> 
-
+    permission="zope.ManageContent" 
+    />
 </configure>

Modified: book/trunk/passwdauth/interfaces.py
===================================================================
--- book/trunk/passwdauth/interfaces.py	2004-08-16 22:10:58 UTC (rev 27154)
+++ book/trunk/passwdauth/interfaces.py	2004-08-16 22:32:47 UTC (rev 27155)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2003 Zope Corporation and Contributors.
+# Copyright (c) 2003, 2004 Zope Corporation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,
@@ -17,7 +17,7 @@
 """
 __docformat__ = 'restructuredtext'
 
-from zope.schema import TextLine
+from zope.schema import TextLine, Field
 from zope.app.i18n import ZopeMessageIDFactory as _
 
 from zope.app.pluggableauth.interfaces import IPrincipalSource

Modified: book/trunk/passwdauth/tests.py
===================================================================
--- book/trunk/passwdauth/tests.py	2004-08-16 22:10:58 UTC (rev 27154)
+++ book/trunk/passwdauth/tests.py	2004-08-16 22:32:47 UTC (rev 27155)
@@ -16,12 +16,15 @@
 $Id$
 """
 import os
-from zope.app.demo import passwdauth
+import unittest
+
 from zope.exceptions import NotFoundError
-from unittest import TestCase, main, makeSuite
 
-class PasswdPrincipalSourceTest(TestCase):
+from book import passwdauth
 
+
+class PasswdPrincipalSourceTest(unittest.TestCase):
+
     def setUp(self):
         dir = os.path.dirname(passwdauth.__file__)
         self.source = passwdauth.PasswdPrincipalSource(
@@ -40,11 +43,10 @@
     def test_authenticate(self):
         self.assertEqual(self.source.authenticate('foo1', 'bar1')._id, 'foo1')
         self.assertEqual(self.source.authenticate('foo1', 'bar'), None)
-        self.assertEqual(self.source.authenticate('foo', 'bar'), None)
+        self.assertEqual(self.source.authenticate('foo', 'bar1'), None)
     
 def test_suite():
-    return makeSuite(PasswdPrincipalSourceTest)
+    return unittest.makeSuite(PasswdPrincipalSourceTest)
     
 if __name__=='__main__':
-    main(defaultTest='test_suite')
-    
+    unittest.main(defaultTest='test_suite')



More information about the Zope-CVS mailing list