[Zope-Checkins] CVS: Zope/lib/python/ZPublisher - BaseResponse.py:1.9 HTTPResponse.py:1.49

Shane Hathaway shane@digicool.com
Fri, 19 Oct 2001 11:12:58 -0400


Update of /cvs-repository/Zope/lib/python/ZPublisher
In directory cvs.zope.org:/tmp/cvs-serv23442/lib/python/ZPublisher

Modified Files:
	BaseResponse.py HTTPResponse.py 
Log Message:
- Merged cAccessControl-review-branch.

- Made some corrections to the DTML tests, which aren't currently working
in testrunner but work when run directly. ??  


=== Zope/lib/python/ZPublisher/BaseResponse.py 1.8 => 1.9 ===
 from string import find, rfind, lower, upper, strip, split, join, translate
 from types import StringType, InstanceType
+from zExceptions import Unauthorized
 
 class BaseResponse:
     """Base Response Class
@@ -226,4 +227,4 @@
 
         Make sure to generate an appropriate challenge, as appropriate.
         """
-        raise 'Unauthorized'
+        raise Unauthorized


=== Zope/lib/python/ZPublisher/HTTPResponse.py 1.48 => 1.49 ===
 from types import StringType, InstanceType, LongType
 from BaseResponse import BaseResponse
+from zExceptions import Unauthorized
 
 nl2sp=string.maketrans('\n',' ')
 
@@ -578,7 +579,7 @@
                 m=m+'<p>\nUsername and password are not correct.'
             else:
                 m=m+'<p>\nNo Authorization header found.'
-        raise 'Unauthorized', m
+        raise Unauthorized, m
 
     def exception(self, fatal=0, info=None,
                   absuri_match=re.compile(r'\w+://[\w\.]+').match,
@@ -588,7 +589,11 @@
         if type(info) is type(()) and len(info)==3: t,v,tb = info
         else: t,v,tb = sys.exc_info()
 
-        if str(t)=='Unauthorized': self._unauthorized()
+        if t=='Unauthorized' or t == Unauthorized or (
+            isinstance(t, types.ClassType) and issubclass(t, Unauthorized)
+            ):
+            t = 'Unauthorized'
+            self._unauthorized()
 
         stb=tb