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

Guido van Rossum guido@python.org
Thu, 13 Dec 2001 12:18:36 -0500

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

Modified Files:
      Tag: Zope-3x-branch
Added Files:
      Tag: Zope-3x-branch
Log Message:
Add IHTTPCredentials interface, implemented by HTTPRequest.

=== Added File Zope3/lib/python/Zope/Publisher/HTTP/IHTTPCredentials.py ===
from Interface import Interface

class IHTTPCredentials(Interface):

    # XXX Eventially this will be a different method

    def _authUserPW():
        """Return (login, password) if there are basic credentials;
        return None if there aren't."""

=== Zope3/lib/python/Zope/Publisher/HTTP/HTTPRequest.py => ===
 import re, sys, os, string, time, whrandom, cgi
+from urllib import quote, unquote, splittype, splitport
 from Zope.Publisher.BaseRequest import BaseRequest
 from HTTPResponse import HTTPResponse
 from cgi_names import isCGI_NAME, hide_key
-from urllib import quote, unquote, splittype, splitport
+from IHTTPCredentials import IHTTPCredentials
 DEFAULT_PORTS = {'http': '80', 'https': '443'}
@@ -72,6 +75,10 @@
     values will be looked up in the order: environment variables,
     other variables, form data, and then cookies.
+    __implements__ = IHTTPCredentials
     _auth = None          # The value of the HTTP_AUTHORIZATION header.
     _computed_urls = ()   # Names of computed URLx variables
     _script = ()          # SERVER_URL + _script + quoted_steps == full URL