[Zope3-checkins] SVN: Zope3/branches/ZopeX3-3.0/src/zope/app/security/browser/auth.py remove unnecessary use of removeAllProxies; replace isinstance() check

Fred L. Drake, Jr. fdrake at gmail.com
Fri Aug 13 11:46:10 EDT 2004


Log message for revision 27110:
  remove unnecessary use of removeAllProxies; replace isinstance() check
  with more appropriate <interface>.providedBy() check
  


Changed:
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/security/browser/auth.py


-=-
Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/security/browser/auth.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/security/browser/auth.py	2004-08-13 15:46:07 UTC (rev 27109)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/security/browser/auth.py	2004-08-13 15:46:10 UTC (rev 27110)
@@ -17,17 +17,15 @@
 """
 from zope.interface import implements
 from zope.app.publisher.interfaces.http import ILogin, ILogout
-from zope.app.security.principalregistry import UnauthenticatedPrincipal
+from zope.app.security.interfaces import IUnauthenticatedPrincipal
 from zope.app.pagetemplate import ViewPageTemplateFile
-from zope.proxy import removeAllProxies
 
 class HTTPAuthenticationLogin(object):
     implements(ILogin)
 
     def login(self, nextURL=None):
         """See zope.app.security.interfaces.ILogin"""
-        if isinstance(removeAllProxies(self.request.principal), \
-                      UnauthenticatedPrincipal):
+        if IUnauthenticatedPrincipal.providedBy(self.request.principal):
             self.request.unauthorized("basic realm='Zope'")
             return self.failed()
         else:
@@ -53,7 +51,7 @@
 
     def logout(self, nextURL=None):
         """See zope.app.security.interfaces.ILogout"""
-        if not isinstance(self.request.principal, UnauthenticatedPrincipal):
+        if not IUnauthenticatedPrincipal.providedBy(self.request.principal):
             self.request.unauthorized("basic realm='Zope'")
             if nextURL:
                 return self.redirect()



More information about the Zope3-Checkins mailing list