[Zope-CVS] CVS: Products/PluggableAuthService - PluggableAuthService.py:1.21

Chris McDonough chrism at plope.com
Mon Nov 8 03:13:32 EST 2004


Update of /cvs-repository/Products/PluggableAuthService
In directory cvs.zope.org:/tmp/cvs-serv22595

Modified Files:
	PluggableAuthService.py 
Log Message:
Give group and user plugins the opportunity to provide their own titles.


=== Products/PluggableAuthService/PluggableAuthService.py 1.20 => 1.21 ===
--- Products/PluggableAuthService/PluggableAuthService.py:1.20	Sat Nov  6 07:09:26 2004
+++ Products/PluggableAuthService/PluggableAuthService.py	Mon Nov  8 03:13:31 2004
@@ -310,7 +310,8 @@
                         info[ 'userid' ] = principal_id
                         info[ 'id' ] = self._computeMangledId( user_info )
                         info[ 'principal_type' ] = 'user'
-                        info[ 'title' ] = info[ 'login' ]
+                        if not info.has_key('title'):
+                            info[ 'title' ] = info[ 'login' ]
                         return ( info, )
                     else:
                         return ()
@@ -347,7 +348,8 @@
                     info[ 'userid' ] = info[ 'id' ]
                     info[ 'id' ] = self._computeMangledId( info )
                     info[ 'principal_type' ] = 'user'
-                    info[ 'title' ] = info[ 'login' ]
+                    if not info.has_key('title'):
+                        info[ 'title' ] = info[ 'login' ]
                     result.append(info)
 
             except _SWALLOWABLE_PLUGIN_EXCEPTIONS:
@@ -392,7 +394,8 @@
                         info[ 'groupid' ] = principal_id
                         info[ 'id' ] = self._computeMangledId( group_info )
                         info[ 'principal_type' ] = 'group'
-                        info[ 'title' ] = "(Group) %s" % principal_id
+                        if not info.has_key('title'):
+                            info[ 'title' ] = "(Group) %s" % principal_id
                         return ( info, )
                     else:
                         return ()
@@ -415,7 +418,8 @@
         if search_name:
             if kw.get('id') is not None:
                 del kw['id']
-            kw['title'] = kw['name']
+            if not kw.has_key('title'):
+                kw['title'] = kw['name']
 
         plugins = self._getOb( 'plugins' )
         enumerators = plugins.listPlugins( IGroupEnumerationPlugin )
@@ -429,7 +433,8 @@
                     info[ 'groupid' ] = info[ 'id' ]
                     info[ 'id' ] = self._computeMangledId( info )
                     info[ 'principal_type' ] = 'group'
-                    info[ 'title' ] = "(Group) %s" % info[ 'groupid' ]
+                    if not info.has_key('title'):
+                        info[ 'title' ] = "(Group) %s" % info[ 'groupid' ]
                     result.append(info)
             except _SWALLOWABLE_PLUGIN_EXCEPTIONS:
                 LOG('PluggableAuthService', WARNING,
@@ -460,7 +465,8 @@
         search_id = kw.get( 'id', None )
         search_name = kw.get( 'name', None )
         if search_name:
-            kw['title'] = search_name
+            if not kw.has_key('title'):
+                kw['title'] = search_name
             kw['login'] = search_name
 
         if exact_match and search_id:
@@ -475,7 +481,10 @@
                     if user_info:
                         local_key = 'userid'
                         principal_type = 'user'
-                        title_key = 'login'
+                        if kw.has_key('title'):
+                            title_key = 'title'
+                        else:
+                            title_key = 'login'
                         title_pattern = "%s"
                 if getattr( aq_base( plugin ), 'enumerateGroups', None ):
                     group_info = plugin.enumerateGroups( id=principal_id
@@ -483,8 +492,12 @@
                     if group_info:
                         local_key = 'groupid'
                         principal_type = 'group'
-                        title_key = 'groupid'
-                        title_pattern = "(Group) %s"
+                        if kw.has_key('title'):
+                            title_key = 'title'
+                            title_pattern = "%s"
+                        else:
+                            title_key = 'groupid'
+                            title_pattern = "(Group) %s"
                 try:
                     principal_info = filter(None, (user_info + group_info))
                     assert( len( principal_info ) in [ 0, 1 ] )
@@ -495,7 +508,8 @@
                         info[ local_key ] = principal_id
                         info[ 'id' ] = self._computeMangledId( principal_info )
                         info[ 'principal_type' ] = principal_type
-                        info[ 'title' ] = title_pattern % info[ title_key ]
+                        if not info.has_key('title'):
+                            info[ 'title' ] = title_pattern % info[ title_key ]
                         return ( info, )
                     else:
                         return ()
@@ -550,6 +564,7 @@
     #
     # ZMI stuff
     #
+    
     arrow_right_gif = ImageFile( 'www/arrow-right.gif', globals() )
     arrow_left_gif = ImageFile( 'www/arrow-left.gif', globals() )
     arrow_up_gif = ImageFile( 'www/arrow-up.gif', globals() )



More information about the Zope-CVS mailing list