[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/pau/ Cosmetic fixes.

Gintautas Miliauskas gintas at pov.lt
Thu Jan 20 06:05:20 EST 2005


Log message for revision 28884:
  Cosmetic fixes.
  

Changed:
  U   Zope3/trunk/src/zope/app/pau/interfaces.py
  U   Zope3/trunk/src/zope/app/pau/principalfolder.py
  U   Zope3/trunk/src/zope/app/pau/principalplugins.py

-=-
Modified: Zope3/trunk/src/zope/app/pau/interfaces.py
===================================================================
--- Zope3/trunk/src/zope/app/pau/interfaces.py	2005-01-20 09:58:56 UTC (rev 28883)
+++ Zope3/trunk/src/zope/app/pau/interfaces.py	2005-01-20 11:05:20 UTC (rev 28884)
@@ -86,8 +86,7 @@
     """
 
 class IExtractionPlugin(IPlugin):
-    """Extracts authentication credentials from a request.
-    """
+    """Extracts authentication credentials from a request."""
 
     def extractCredentials(request):
         """Try to extract credentials from a request
@@ -97,8 +96,7 @@
         """
 
 class IAuthenticationPlugin(IPrincipalIdAwarePlugin):
-    """Authenticate credentials
-    """
+    """Authenticate credentials."""
 
     def authenticateCredentials(credentials):
         """Authenticate credentials
@@ -109,8 +107,7 @@
         """
 
 class IChallengePlugin(IPlugin):
-    """Initiate a challenge to the user to provide credentials.
-    """
+    """Initiate a challenge to the user to provide credentials."""
 
     protocol = zope.interface.Attribute("""Optional Challenger protocol
 
@@ -129,11 +126,10 @@
         """
 
 class IPrincipalFactoryPlugin(IPlugin):
-    """Create a principal object
-    """
+    """Create a principal object."""
 
     def createAuthenticatedPrincipal(principal_id, info, request):
-        """Create a principal authenticated against a request
+        """Create a principal authenticated against a request.
 
         The info argument is a dictionary containing supplemental
         information that can be used by the factory and by event
@@ -160,7 +156,7 @@
         """
 
 class IPrincipalSearchPlugin(IPrincipalIdAwarePlugin):
-    """Find principals
+    """Find principals.
 
     Principal search plugins provide two functions:
 
@@ -194,7 +190,7 @@
     """)
 
     def search(query, start=None, batch_size=None):
-        """Search for principals
+        """Search for principals.
 
         The query argument is a mapping object with items defined by
         the plugins.  An iterable of principal ids should be returned.
@@ -210,14 +206,13 @@
 
 class ISearchableAuthenticationPlugin(IAuthenticationPlugin,
                                       IPrincipalSearchPlugin):
-    """Components that provide authentication ans searching
+    """Components that provide authentication and searching.
 
     This interface exists to make component registration a little bit easier.
     """
 
 class IExtractionAndChallengePlugin(IExtractionPlugin, IChallengePlugin):
-    """Components that provide credential extraction and challenge
+    """Components that provide credential extraction and challenge.
 
     This interface exists to make component registration a little bit easier.
     """
-    

Modified: Zope3/trunk/src/zope/app/pau/principalfolder.py
===================================================================
--- Zope3/trunk/src/zope/app/pau/principalfolder.py	2005-01-20 09:58:56 UTC (rev 28883)
+++ Zope3/trunk/src/zope/app/pau/principalfolder.py	2005-01-20 11:05:20 UTC (rev 28884)
@@ -31,6 +31,7 @@
 
 from zope.app.pau import interfaces
 
+
 class IInternalPrincipal(zope.interface.Interface):
     """Principal information"""
 
@@ -94,10 +95,10 @@
         missing_value=u'',
         )
 
+
 class PrincipalInformation(
     persistent.Persistent,
-    zope.app.container.contained.Contained,
-    ):
+    zope.app.container.contained.Contained,):
     """An internal principal for Persistent Principal Folder.
     """
     zope.interface.implements(IInternalPrincipal, IInternalPrincipalContained)
@@ -127,9 +128,10 @@
         if attr in ('title', 'description'):
             return getattr(self, attr)
 
+
 class PrincipalFolder(zope.app.container.btree.BTreeContainer):
-    """A Persistent Principal Folder and Authentication plugin
-    """
+    """A Persistent Principal Folder and Authentication plugin."""
+
     zope.interface.implements(interfaces.ISearchableAuthenticationPlugin,
                               interfaces.IQuerySchemaSearch,
                               IInternalPrincipalContainer)
@@ -150,10 +152,9 @@
 
         del self.__id_by_login[oldLogin]
         self.__id_by_login[principal.login] = principal.__name__
-        
+
     def __setitem__(self, id, principal):
-        """Add principal information
-        """
+        """Add principal information."""
         # A user with the new login already exists
         if principal.login in self.__id_by_login:
             raise ValueError, 'Principal Login already taken!'
@@ -168,7 +169,6 @@
         super(PrincipalFolder, self).__delitem__(id)
         del self.__id_by_login[principal.login]
 
-
     def authenticateCredentials(self, credentials):
         """Return principal info if credentials can be authenticated
         """
@@ -186,27 +186,24 @@
         if principal.password != credentials['password']:
             return None
 
-        id = self.prefix+id
+        id = self.prefix + id
 
-        return id, {'login': principal.login, 'title': principal.title,
+        return id, {'login': principal.login,
+                    'title': principal.title,
                     'description': principal.description}
 
     def principalInfo(self, principal_id):
         if principal_id.startswith(self.prefix):
             principal = self.get(principal_id[len(self.prefix):])
             if principal is not None:
-                return {
-                    'login': principal.login,
-                    'title': principal.title,
-                    'description': principal.description,
-                    }
-            
+                return {'login': principal.login,
+                        'title': principal.title,
+                        'description': principal.description}
 
     schema = ISearchSchema
 
     def search(self, query, start=None, batch_size=None):
-        """Search through this principal provider.
-        """
+        """Search through this principal provider."""
         search = query.get('search')
         if search is None:
             return

Modified: Zope3/trunk/src/zope/app/pau/principalplugins.py
===================================================================
--- Zope3/trunk/src/zope/app/pau/principalplugins.py	2005-01-20 09:58:56 UTC (rev 28883)
+++ Zope3/trunk/src/zope/app/pau/principalplugins.py	2005-01-20 11:05:20 UTC (rev 28884)
@@ -48,7 +48,7 @@
         self.groups = []
 
     def __repr__(self):
-        return 'Principal(%r)' %self.id
+        return 'Principal(%r)' % self.id
 
 
 class PrincipalFactory:
@@ -87,7 +87,7 @@
     >>> event.info
     {}
     """
-    implements(interfaces.IPrincipalFactoryPlugin)           
+    implements(interfaces.IPrincipalFactoryPlugin)
 
     def createAuthenticatedPrincipal(self, id, info, request):
         """See zope.app.pau.interfaces.IPrincipalFactoryPlugin"""
@@ -103,6 +103,7 @@
         notify(interfaces.FoundPrincipalCreated(principal, info))
         return principal
 
+
 def addTitleAndDescription(event):
     """Set title and description from info
 



More information about the Zope3-Checkins mailing list