[Checkins] SVN: zope. Revert the move of password manager names vocabulary.

Dan Korostelev nadako at gmail.com
Tue Mar 10 06:51:19 EDT 2009


Log message for revision 97795:
  Revert the move of password manager names vocabulary.

Changed:
  U   zope.app.authentication/trunk/CHANGES.txt
  U   zope.app.authentication/trunk/buildout.cfg
  U   zope.app.authentication/trunk/src/zope/app/authentication/password.py
  U   zope.app.authentication/trunk/src/zope/app/authentication/password.zcml
  U   zope.password/trunk/CHANGES.txt
  U   zope.password/trunk/README.txt
  U   zope.password/trunk/setup.py
  U   zope.password/trunk/src/zope/password/configure.zcml
  U   zope.password/trunk/src/zope/password/testing.py
  D   zope.password/trunk/src/zope/password/vocabulary.py

-=-
Modified: zope.app.authentication/trunk/CHANGES.txt
===================================================================
--- zope.app.authentication/trunk/CHANGES.txt	2009-03-10 10:50:12 UTC (rev 97794)
+++ zope.app.authentication/trunk/CHANGES.txt	2009-03-10 10:51:18 UTC (rev 97795)
@@ -7,9 +7,6 @@
 
 * Remove deprecated code.
 
-* The "Password Manager Names" vocabulary was moved to the ``zope.password``
-  package.
-
 3.5.0 (2009-03-06)
 ------------------
 

Modified: zope.app.authentication/trunk/buildout.cfg
===================================================================
--- zope.app.authentication/trunk/buildout.cfg	2009-03-10 10:50:12 UTC (rev 97794)
+++ zope.app.authentication/trunk/buildout.cfg	2009-03-10 10:51:18 UTC (rev 97795)
@@ -1,5 +1,5 @@
 [buildout]
-develop = . ../zope.password
+develop = .
 parts = test
 
 [test]

Modified: zope.app.authentication/trunk/src/zope/app/authentication/password.py
===================================================================
--- zope.app.authentication/trunk/src/zope/app/authentication/password.py	2009-03-10 10:50:12 UTC (rev 97794)
+++ zope.app.authentication/trunk/src/zope/app/authentication/password.py	2009-03-10 10:51:18 UTC (rev 97795)
@@ -17,6 +17,8 @@
 """
 __docformat__ = 'restructuredtext'
 
+from zope.app.component.vocabulary import UtilityVocabulary
+
 # BBB: the password managers were moved into zope.password package.
 from zope.password.password import (
     PlainTextPasswordManager,
@@ -25,7 +27,6 @@
     SSHAPasswordManager
     )
 from zope.password.interfaces import IPasswordManager
-from zope.password.vocabulary import PasswordManagerNamesVocabulary
 
 # Simple registry used by mkzopeinstance script
 managers = [
@@ -34,3 +35,10 @@
     ("SHA1", SHA1PasswordManager()),
     ("SSHA", SSHAPasswordManager()),
 ]
+
+
+class PasswordManagerNamesVocabulary(UtilityVocabulary):
+    """Vocabulary of password managers."""
+
+    interface = IPasswordManager
+    nameOnly = True

Modified: zope.app.authentication/trunk/src/zope/app/authentication/password.zcml
===================================================================
--- zope.app.authentication/trunk/src/zope/app/authentication/password.zcml	2009-03-10 10:50:12 UTC (rev 97794)
+++ zope.app.authentication/trunk/src/zope/app/authentication/password.zcml	2009-03-10 10:51:18 UTC (rev 97795)
@@ -2,4 +2,10 @@
 
   <include package="zope.password" />
 
+  <utility
+      component=".password.PasswordManagerNamesVocabulary"
+      provides="zope.schema.interfaces.IVocabularyFactory"
+      name="Password Manager Names"
+      />
+
 </configure>

Modified: zope.password/trunk/CHANGES.txt
===================================================================
--- zope.password/trunk/CHANGES.txt	2009-03-10 10:50:12 UTC (rev 97794)
+++ zope.password/trunk/CHANGES.txt	2009-03-10 10:51:18 UTC (rev 97795)
@@ -5,16 +5,8 @@
 3.5.1 (unreleased)
 ------------------
 
-- Make security protection directives in `configure.zcml` execute only
-  if ``zope.security`` is installed. This will allow reuse of the
-  `configure.zcml` file in environments without ``zope.security``,
-  for example with ``repoze.zcml``.
+- ...
 
-- Add "Password Manager Names" vocabulary for use with ``zope.schema``
-  and ``zope.component``. This change doesn't add depdendency on them,
-  because it's an optional feature and one who want to use that vocabulary
-  is probably already have them installed.
-
 3.5.0 (2009-03-06)
 ------------------
 

Modified: zope.password/trunk/README.txt
===================================================================
--- zope.password/trunk/README.txt	2009-03-10 10:50:12 UTC (rev 97794)
+++ zope.password/trunk/README.txt	2009-03-10 10:51:18 UTC (rev 97795)
@@ -25,7 +25,6 @@
 
 It is strongly recommended to use SSHAPasswordManager, as it's the most secure.
 
-
 Usage
 -----
 
@@ -39,17 +38,3 @@
       """Return whether the given encoded data coincide with the given password"""
 
 The implementations mentioned above are in the ``zope.password.password`` module.
-
-
-Password Manager Names Vocabulary
----------------------------------
-
-The ``zope.password.vocabulary`` module provides a vocabulary of registered
-password manager utility names. It is typically registered as an
-`IVocabularyFactory` utility named "Password Manager Names".
-
-It's intended to be used with ``zope.component`` and ``zope.schema``, so
-you need to have them installed and the utility registrations needs to
-be done properly. The `configure.zcml` file, contained in ``zope.password``
-does the registrations, as well as in `setUpPasswordManagers` function in
-``zope.password.testing`` module.

Modified: zope.password/trunk/setup.py
===================================================================
--- zope.password/trunk/setup.py	2009-03-10 10:50:12 UTC (rev 97794)
+++ zope.password/trunk/setup.py	2009-03-10 10:51:18 UTC (rev 97795)
@@ -43,9 +43,7 @@
       keywords='zope3 zope authentication password',
       packages=find_packages('src'),
       package_dir = {'': 'src'},
-      extras_require=dict(test=['zope.testing',
-                                'zope.component',
-                                'zope.schema']),
+      extras_require=dict(test=['zope.testing', 'zope.component']),
       namespace_packages=['zope'],
       install_requires=['setuptools',
                         'zope.interface',

Modified: zope.password/trunk/src/zope/password/configure.zcml
===================================================================
--- zope.password/trunk/src/zope/password/configure.zcml	2009-03-10 10:50:12 UTC (rev 97794)
+++ zope.password/trunk/src/zope/password/configure.zcml	2009-03-10 10:51:18 UTC (rev 97795)
@@ -1,56 +1,43 @@
 <configure xmlns="http://namespaces.zope.org/zope">
 
+  <class class=".password.PlainTextPasswordManager">
+    <allow interface=".interfaces.IPasswordManager" />
+  </class>
+
   <utility
       name="Plain Text"
       provides=".interfaces.IPasswordManager"
       factory=".password.PlainTextPasswordManager"
       />
 
+  <class class=".password.MD5PasswordManager">
+    <allow interface=".interfaces.IPasswordManager" />
+  </class>
+
   <utility
       name="MD5"
       provides=".interfaces.IPasswordManager"
       factory=".password.MD5PasswordManager"
       />
 
+  <class class=".password.SHA1PasswordManager">
+    <allow interface=".interfaces.IPasswordManager" />
+  </class>
+
   <utility
       name="SHA1"
       provides=".interfaces.IPasswordManager"
       factory=".password.SHA1PasswordManager"
       />
 
+  <class class=".password.SSHAPasswordManager">
+    <allow interface=".interfaces.IPasswordManager" />
+  </class>
+
   <utility
       name="SSHA"
       provides=".interfaces.IPasswordManager"
       factory=".password.SSHAPasswordManager"
       />
 
-  <utility
-      component=".vocabulary.PasswordManagerNamesVocabulary"
-      provides="zope.schema.interfaces.IVocabularyFactory"
-      name="Password Manager Names"
-      />
-
-  <configure
-      xmlns:zcml="http://namespaces.zope.org/zcml"
-      zcml:condition="installed zope.security"
-      >
-
-    <class class=".password.PlainTextPasswordManager">
-      <allow interface=".interfaces.IPasswordManager" />
-    </class>
-  
-    <class class=".password.MD5PasswordManager">
-      <allow interface=".interfaces.IPasswordManager" />
-    </class>
-  
-    <class class=".password.SHA1PasswordManager">
-      <allow interface=".interfaces.IPasswordManager" />
-    </class>
-  
-    <class class=".password.SSHAPasswordManager">
-      <allow interface=".interfaces.IPasswordManager" />
-    </class>
-
-  </configure>
-
 </configure>

Modified: zope.password/trunk/src/zope/password/testing.py
===================================================================
--- zope.password/trunk/src/zope/password/testing.py	2009-03-10 10:50:12 UTC (rev 97794)
+++ zope.password/trunk/src/zope/password/testing.py	2009-03-10 10:51:18 UTC (rev 97795)
@@ -16,16 +16,12 @@
 $Id$
 """
 __docformat__ = "reStructuredText"
-
 from zope.component import provideUtility
-from zope.schema.interfaces import IVocabularyFactory
-
 from zope.password.interfaces import IPasswordManager
 from zope.password.password import PlainTextPasswordManager
 from zope.password.password import MD5PasswordManager
 from zope.password.password import SHA1PasswordManager
 from zope.password.password import SSHAPasswordManager
-from zope.password.vocabulary import PasswordManagerNamesVocabulary
 
 
 def setUpPasswordManagers():
@@ -33,7 +29,6 @@
     
     >>> from zope.component import getUtility
     >>> setUpPasswordManagers()
-
     >>> getUtility(IPasswordManager, 'Plain Text')
     <zope.password.password.PlainTextPasswordManager object at 0x...>
     >>> getUtility(IPasswordManager, 'SSHA')
@@ -42,25 +37,9 @@
     <zope.password.password.MD5PasswordManager object at 0x...>
     >>> getUtility(IPasswordManager, 'SHA1')
     <zope.password.password.SHA1PasswordManager object at 0x...>
-
-    >>> voc = getUtility(IVocabularyFactory, 'Password Manager Names')
-    >>> voc = voc(None)
-    >>> voc
-    <zope.schema.vocabulary.SimpleVocabulary object at 0x...>
-    >>> 'SSHA' in voc
-    True
-    >>> 'Plain Text' in voc
-    True
-    >>> 'SHA1' in voc
-    True
-    >>> 'MD5' in voc
-    True
     
     """
     provideUtility(PlainTextPasswordManager(), IPasswordManager, 'Plain Text')
     provideUtility(SSHAPasswordManager(), IPasswordManager, 'SSHA')
     provideUtility(MD5PasswordManager(), IPasswordManager, 'MD5')
     provideUtility(SHA1PasswordManager(), IPasswordManager, 'SHA1')
-
-    provideUtility(PasswordManagerNamesVocabulary,
-                   IVocabularyFactory, 'Password Manager Names')

Deleted: zope.password/trunk/src/zope/password/vocabulary.py
===================================================================
--- zope.password/trunk/src/zope/password/vocabulary.py	2009-03-10 10:50:12 UTC (rev 97794)
+++ zope.password/trunk/src/zope/password/vocabulary.py	2009-03-10 10:51:18 UTC (rev 97795)
@@ -1,34 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2009 Zope Foundation 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.
-#
-##############################################################################
-"""Vocabulary of password manager utility names
-
-This requires zope.schema, but you probably already have it, if you want
-to use this vocabulary.
-
-$Id$
-"""
-from zope.component import getUtilitiesFor
-from zope.interface import directlyProvides
-from zope.schema.interfaces import IVocabularyFactory
-from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm
-
-from zope.password.interfaces import IPasswordManager
-
-def PasswordManagerNamesVocabulary(context=None):
-    terms = []
-    for name, util in getUtilitiesFor(IPasswordManager, context):
-        terms.append(SimpleTerm(name))
-    return SimpleVocabulary(terms)
-
-directlyProvides(PasswordManagerNamesVocabulary, IVocabularyFactory)



More information about the Checkins mailing list