[Zope-Checkins] CVS: Zope3/lib/python/Zope/Publisher/HTTP - HTTPRequest.py:1.1.2.15 IHTTPCredentials.py:1.1.2.2

Guido van Rossum guido@python.org
Thu, 13 Dec 2001 15:43:29 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/Publisher/HTTP
In directory cvs.zope.org:/tmp/cvs-serv26609/HTTP

Modified Files:
      Tag: Zope-3x-branch
	HTTPRequest.py IHTTPCredentials.py 
Log Message:
Add unauthorized(challenge) method to IHTTPCredentials, and implemented it
in HTTPRequest.

=== Zope3/lib/python/Zope/Publisher/HTTP/HTTPRequest.py 1.1.2.14 => 1.1.2.15 ===
                 return name, password
 
+    def unauthorized(self, challenge):
+        self.response.setHeader("WWW-Authenticate", challenge, 1)
+        self.response.setStatus(401)
+
 
 base64 = None
 


=== Zope3/lib/python/Zope/Publisher/HTTP/IHTTPCredentials.py 1.1.2.1 => 1.1.2.2 ===
 
     # XXX Eventially this will be a different method
-
     def _authUserPW():
         """Return (login, password) if there are basic credentials;
         return None if there aren't."""
+
+    def unauthorized(challenge):
+        """Issue a 401 Unauthorized error (asking for login/password).
+        The challenge is the value of the WWW-Authenticate header."""