[Checkins] SVN: Products.PluggableAuthService/trunk/Products/PluggableAuthService/ Launchpad #300321: ZODBGroupManager.enumerateGroups failed to find groups with unicode IDs.

Tres Seaver tseaver at palladion.com
Thu Nov 20 10:02:37 EST 2008


Log message for revision 93160:
  Launchpad #300321:  ZODBGroupManager.enumerateGroups failed to find groups with unicode IDs.
  

Changed:
  U   Products.PluggableAuthService/trunk/Products/PluggableAuthService/doc/CHANGES.txt
  U   Products.PluggableAuthService/trunk/Products/PluggableAuthService/plugins/ZODBGroupManager.py
  U   Products.PluggableAuthService/trunk/Products/PluggableAuthService/plugins/tests/test_ZODBGroupManager.py

-=-
Modified: Products.PluggableAuthService/trunk/Products/PluggableAuthService/doc/CHANGES.txt
===================================================================
--- Products.PluggableAuthService/trunk/Products/PluggableAuthService/doc/CHANGES.txt	2008-11-20 15:02:16 UTC (rev 93159)
+++ Products.PluggableAuthService/trunk/Products/PluggableAuthService/doc/CHANGES.txt	2008-11-20 15:02:37 UTC (rev 93160)
@@ -4,6 +4,8 @@
 PluggableAuthService 1.7 (unreleased)
 -------------------------------------
 
+- Launchpad #300321:  ZODBGroupManager.enumerateGroups failed to find
+  groups with unicode IDs.
 
 PluggableAuthService 1.6 (2008-08-05)
 -------------------------------------

Modified: Products.PluggableAuthService/trunk/Products/PluggableAuthService/plugins/ZODBGroupManager.py
===================================================================
--- Products.PluggableAuthService/trunk/Products/PluggableAuthService/plugins/ZODBGroupManager.py	2008-11-20 15:02:16 UTC (rev 93159)
+++ Products.PluggableAuthService/trunk/Products/PluggableAuthService/plugins/ZODBGroupManager.py	2008-11-20 15:02:37 UTC (rev 93160)
@@ -90,10 +90,10 @@
         group_ids = []
         plugin_id = self.getId()
 
-        if isinstance( id, str ):
+        if isinstance( id, basestring ):
             id = [ id ]
 
-        if isinstance( title, str ):
+        if isinstance( title, basestring ):
             title = [ title ]
 
         if exact_match and ( id or title ):

Modified: Products.PluggableAuthService/trunk/Products/PluggableAuthService/plugins/tests/test_ZODBGroupManager.py
===================================================================
--- Products.PluggableAuthService/trunk/Products/PluggableAuthService/plugins/tests/test_ZODBGroupManager.py	2008-11-20 15:02:16 UTC (rev 93159)
+++ Products.PluggableAuthService/trunk/Products/PluggableAuthService/plugins/tests/test_ZODBGroupManager.py	2008-11-20 15:02:37 UTC (rev 93160)
@@ -193,6 +193,38 @@
         self.assertEqual( zgm.enumerateGroups( id='qux', exact_match=True )
                         , () )
 
+    def test_enumerateGroups_exact_string( self ):
+        from Products.PluggableAuthService.tests.test_PluggableAuthService \
+            import FauxRoot
+
+        root = FauxRoot()
+        zgm = self._makeOne(id='exact_nonesuch').__of__(root)
+
+        ID_LIST = ('foo', 'bar', 'baz', 'bam')
+
+        for id in ID_LIST:
+            zgm.addGroup(id, 'Group %s' % id, 'This is group, %s' % id)
+
+        info = zgm.enumerateGroups(id='foo', exact_match=True)
+        self.assertEqual(len(info), 1)
+        self.assertEqual(info[0]['id'], 'foo')
+
+    def test_enumerateGroups_exact_unicode( self ):
+        from Products.PluggableAuthService.tests.test_PluggableAuthService \
+            import FauxRoot
+
+        root = FauxRoot()
+        zgm = self._makeOne(id='exact_nonesuch').__of__(root)
+
+        ID_LIST = ('foo', 'bar', 'baz', 'bam')
+
+        for id in ID_LIST:
+            zgm.addGroup(id, 'Group %s' % id, 'This is group, %s' % id)
+
+        info = zgm.enumerateGroups(id=u'foo', exact_match=True)
+        self.assertEqual(len(info), 1)
+        self.assertEqual(info[0]['id'], 'foo')
+
     def test_enumerateGroups_multiple( self ):
         from Products.PluggableAuthService.tests.test_PluggableAuthService \
             import FauxRoot
@@ -203,7 +235,6 @@
         ID_LIST = ( 'foo', 'bar', 'baz', 'bam' )
 
         for id in ID_LIST:
-
             zrm.addGroup( id, 'Group %s' % id, 'This is group, %s' % id )
 
         info_list = zrm.enumerateGroups( id=ID_LIST, exact_match=False )



More information about the Checkins mailing list