[Checkins] SVN: Sandbox/luciano/kirbi/src/kirbi/ added ZPL text; removed dependency from user.py

Luciano Ramalho luciano at ramalho.org
Sat Aug 18 16:43:31 EDT 2007


Log message for revision 78971:
  added ZPL text; removed dependency from user.py
  

Changed:
  U   Sandbox/luciano/kirbi/src/kirbi/app.py
  U   Sandbox/luciano/kirbi/src/kirbi/book.py
  U   Sandbox/luciano/kirbi/src/kirbi/copy.py
  U   Sandbox/luciano/kirbi/src/kirbi/ftests/user.txt
  U   Sandbox/luciano/kirbi/src/kirbi/interfaces.py
  U   Sandbox/luciano/kirbi/src/kirbi/isbn.py
  U   Sandbox/luciano/kirbi/src/kirbi/pac.py
  U   Sandbox/luciano/kirbi/src/kirbi/user.py

-=-
Modified: Sandbox/luciano/kirbi/src/kirbi/app.py
===================================================================
--- Sandbox/luciano/kirbi/src/kirbi/app.py	2007-08-18 19:46:00 UTC (rev 78970)
+++ Sandbox/luciano/kirbi/src/kirbi/app.py	2007-08-18 20:43:31 UTC (rev 78971)
@@ -1,3 +1,19 @@
+##############################################################################
+#
+# Copyright (c) 2006 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.
+#
+##############################################################################
+"""Kirbi
+"""
+
 import grok
 from grok import index
 from kirbi.pac import Pac
@@ -2,3 +18,2 @@
 from kirbi.book import Book
-from kirbi.user import User, UserFolder
 from kirbi.interfaces import IUser
@@ -22,7 +37,6 @@
 from zope.component import getUtility
 
 PAC_NAME = u'pac'
-USER_FOLDER_NAME = u'u'
 
 grok.define_permission('kirbi.AddCopy')
 grok.define_permission('kirbi.ManageBook')
@@ -50,7 +64,6 @@
     def __init__(self):
         super(Kirbi, self).__init__()
         self.pac = self[PAC_NAME] = Pac()
-        self.userFolder = self[USER_FOLDER_NAME] = UserFolder()
 
 @grok.subscribe(Kirbi, grok.IObjectAddedEvent)
 def grant_permissions(app, event):
@@ -115,7 +128,7 @@
         #XXX: change this method to use our UserFolder and User class instead
         #     of PrincipalFolder and InternalPrincipal
         login = data['login']
-        self.context[login] = User(**data)
+        #self.context[login] = User(**data)
     
         # add principal to principal folder
         pau = getUtility(IAuthentication)

Modified: Sandbox/luciano/kirbi/src/kirbi/book.py
===================================================================
--- Sandbox/luciano/kirbi/src/kirbi/book.py	2007-08-18 19:46:00 UTC (rev 78970)
+++ Sandbox/luciano/kirbi/src/kirbi/book.py	2007-08-18 20:43:31 UTC (rev 78971)
@@ -1,3 +1,19 @@
+##############################################################################
+#
+# Copyright (c) 2006 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.
+#
+##############################################################################
+"""Kirbi Book record class and views
+"""
+
 import grok
 from interfaces import IBook
 from zope.interface import implements

Modified: Sandbox/luciano/kirbi/src/kirbi/copy.py
===================================================================
--- Sandbox/luciano/kirbi/src/kirbi/copy.py	2007-08-18 19:46:00 UTC (rev 78970)
+++ Sandbox/luciano/kirbi/src/kirbi/copy.py	2007-08-18 20:43:31 UTC (rev 78971)
@@ -1,3 +1,19 @@
+##############################################################################
+#
+# Copyright (c) 2006 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.
+#
+##############################################################################
+"""Kirbi book exemplar class
+"""
+
 import grok
 from interfaces import ICopy, ILease
 from zope.interface import Interface, implements, invariant

Modified: Sandbox/luciano/kirbi/src/kirbi/ftests/user.txt
===================================================================
--- Sandbox/luciano/kirbi/src/kirbi/ftests/user.txt	2007-08-18 19:46:00 UTC (rev 78970)
+++ Sandbox/luciano/kirbi/src/kirbi/ftests/user.txt	2007-08-18 20:43:31 UTC (rev 78971)
@@ -4,7 +4,8 @@
 
 Users can be adapted to ``IPrincipalInfo``::
 
-    >>> from kirbi.user import IUser, User
+    >>> from kirbi.user import User, UserFolder
+    >>> from kirbi.interfaces import IUser
     >>> from zope.app.authentication.interfaces import IPrincipalInfo
     >>> alice = User(u'alice', u'Vincent Damon Furnier', u'1234')
     >>> IUser.providedBy(alice)
@@ -20,42 +21,35 @@
     >>> alice.name
     u'Alice Cooper'
     
-Each ``Kirbi`` instance contains a ``UserFolder`` which provides
-``IAuthenticatorPlugin`` so it can be used to authenticate users. 
+``UserFolder`` instances provide ``IAuthenticatorPlugin`` so they can be used
+to authenticate users. 
 
-To test this, we need to setup a Kirbi app::
-
-    >>> from kirbi.app import Kirbi
-    >>> root = getRootFolder()
-    >>> kirbi_app = root['kirbi'] = Kirbi()
-    >>> kirbi_app.userFolder
-    <kirbi.user.UserFolder object ...>
-    
+    >>> userFolder = UserFolder()
     >>> from zope.app.authentication.interfaces import IAuthenticatorPlugin
-    >>> IAuthenticatorPlugin.providedBy(kirbi_app.userFolder)
+    >>> IAuthenticatorPlugin.providedBy(userFolder)
     True
     
 Now we put the ``alice`` user created before in the ``userFolder``, and
 exercise the ``IAuthenticatorPlugin`` methods::
     
-    >>> kirbi_app.userFolder[u'alice'] = alice
-    >>> principal = kirbi_app.userFolder.principalInfo(u'alice')
+    >>> userFolder[u'alice'] = alice
+    >>> principal = userFolder.principalInfo(u'alice')
     >>> principal.description
     u'Alice Cooper (alice)'
     
-    >>> kirbi_app.userFolder.principalInfo('nonexistent-user') is None
+    >>> userFolder.principalInfo('nonexistent-user') is None
     True
     
     >>> good_credentials = {'login':u'alice','password':u'1234'}
     >>> bad_login_cred = {'login':u'bob','password':u'1234'}
     >>> bad_passwd_cred = {'login':u'alice','password':u'9999'}
-    >>> principal = kirbi_app.userFolder.authenticateCredentials(good_credentials)
+    >>> principal = userFolder.authenticateCredentials(good_credentials)
     >>> principal.description
     u'Alice Cooper (alice)'
 
-    >>> kirbi_app.userFolder.authenticateCredentials(bad_login_cred) is None
+    >>> userFolder.authenticateCredentials(bad_login_cred) is None
     True
-    >>> kirbi_app.userFolder.authenticateCredentials(bad_passwd_cred) is None
+    >>> userFolder.authenticateCredentials(bad_passwd_cred) is None
     True
     
     

Modified: Sandbox/luciano/kirbi/src/kirbi/interfaces.py
===================================================================
--- Sandbox/luciano/kirbi/src/kirbi/interfaces.py	2007-08-18 19:46:00 UTC (rev 78970)
+++ Sandbox/luciano/kirbi/src/kirbi/interfaces.py	2007-08-18 20:43:31 UTC (rev 78971)
@@ -1,3 +1,19 @@
+##############################################################################
+#
+# Copyright (c) 2006 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.
+#
+##############################################################################
+"""Kirbi interfaces
+"""
+
 from zope.interface import Interface, invariant, Invalid
 from zope import schema
 from isbn import isValidISBN

Modified: Sandbox/luciano/kirbi/src/kirbi/isbn.py
===================================================================
--- Sandbox/luciano/kirbi/src/kirbi/isbn.py	2007-08-18 19:46:00 UTC (rev 78970)
+++ Sandbox/luciano/kirbi/src/kirbi/isbn.py	2007-08-18 20:43:31 UTC (rev 78971)
@@ -1,5 +1,18 @@
-#!/usr/bin/env python
-# -*-coding: utf-8 -*-
+##############################################################################
+#
+# Copyright (c) 2006 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.
+#
+##############################################################################
+"""Kirbi ISBN handling functions
+"""
 
 def filterDigits(input):
     """ Strip the input of all non-digits, but retain last X if present. """

Modified: Sandbox/luciano/kirbi/src/kirbi/pac.py
===================================================================
--- Sandbox/luciano/kirbi/src/kirbi/pac.py	2007-08-18 19:46:00 UTC (rev 78970)
+++ Sandbox/luciano/kirbi/src/kirbi/pac.py	2007-08-18 20:43:31 UTC (rev 78971)
@@ -1,3 +1,19 @@
+##############################################################################
+#
+# Copyright (c) 2006 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.
+#
+##############################################################################
+"""Kirbi's Public Access Catalog
+"""
+
 import grok
 from book import Book, IBook
 from zope.app.container.contained import NameChooser as BaseNameChooser

Modified: Sandbox/luciano/kirbi/src/kirbi/user.py
===================================================================
--- Sandbox/luciano/kirbi/src/kirbi/user.py	2007-08-18 19:46:00 UTC (rev 78970)
+++ Sandbox/luciano/kirbi/src/kirbi/user.py	2007-08-18 20:43:31 UTC (rev 78971)
@@ -1,3 +1,31 @@
+##############################################################################
+#
+# Copyright (c) 2006 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.
+#
+##############################################################################
+"""Kirbi User module
+
+This is currently (Aug. 18 2007) not used.
+
+The code is tested (see doctests at ftests/user.txt and below), but has
+not been integrated into Kirbi because I am uncertain about the wisdom
+of creating a UserFolder which will behave as a utility but also as a
+container of content (User instances, which in turn would contain Copy
+instances etc.). How would traversal work, form example?
+
+For now, I'll stick with a regular PrincipalFolder/Internal principal for
+user management, and create a plain Collection class to hold the user's
+Copies.
+"""
+
 import grok
 from interfaces import IUser
 from zope.app.authentication.interfaces import IPrincipalInfo



More information about the Checkins mailing list