Log message for revision 68780:
  Collector #2136: Map ResourceLockedError to the correct response code.

Changed:
  U   Zope/branches/2.10/doc/CHANGES.txt
  U   Zope/branches/2.10/lib/python/ZPublisher/HTTPResponse.py
  U   Zope/branches/2.10/lib/python/ZPublisher/tests/testHTTPResponse.py

-=-
Modified: Zope/branches/2.10/doc/CHANGES.txt
===================================================================
--- Zope/branches/2.10/doc/CHANGES.txt  2006-06-21 16:48:26 UTC (rev 68779)
+++ Zope/branches/2.10/doc/CHANGES.txt  2006-06-21 16:50:26 UTC (rev 68780)
@@ -18,6 +18,8 @@
 
     Bugs Fixed
 
+      - Collector #2136: Map ResourceLockedError to the correct response code.
+
       - Collector #2016: DemoStorage couldn't wrap base storages without
                          an '_oid' attribute.
 

Modified: Zope/branches/2.10/lib/python/ZPublisher/HTTPResponse.py
===================================================================
--- Zope/branches/2.10/lib/python/ZPublisher/HTTPResponse.py    2006-06-21 
16:48:26 UTC (rev 68779)
+++ Zope/branches/2.10/lib/python/ZPublisher/HTTPResponse.py    2006-06-21 
16:50:26 UTC (rev 68780)
@@ -97,6 +97,7 @@
 status_codes['nameerror'] = 503
 status_codes['keyerror'] = 503
 status_codes['redirect'] = 300
+status_codes['resourcelockederror'] = 423
 
 
 start_of_header_search = re.compile('(<head[^>]*>)', re.IGNORECASE).search

Modified: Zope/branches/2.10/lib/python/ZPublisher/tests/testHTTPResponse.py
===================================================================
--- Zope/branches/2.10/lib/python/ZPublisher/tests/testHTTPResponse.py  
2006-06-21 16:48:26 UTC (rev 68779)
+++ Zope/branches/2.10/lib/python/ZPublisher/tests/testHTTPResponse.py  
2006-06-21 16:50:26 UTC (rev 68780)
@@ -51,7 +51,8 @@
         # Verify that the cookie is expired even if an expires kw arg is passed
         # http://zope.org/Collectors/Zope/1160
         response = self._makeOne()
-        response.expireCookie('foo', path='/', expires='Mon, 22-Mar-2004 17:59 
GMT', max_age=99)
+        response.expireCookie('foo', path='/',
+                              expires='Mon, 22-Mar-2004 17:59 GMT', max_age=99)
         cookie = response.cookies.get('foo', None)
         self.failUnless(cookie)
         self.assertEqual(cookie.get('expires'), 'Wed, 31-Dec-97 23:59:59 GMT')
@@ -76,27 +77,43 @@
         response.appendHeader('XXX', 'foo')
         self.assertEqual(response.headers.get('xxx'), 'bar,\n\tfoo')
 
-    def test_CharsetNoHeader(self):
+    def test_setStatus_ResourceLockedError(self):
+        response = self._makeOne()
+        from webdav.Lockable import ResourceLockedError
+        response.setStatus(ResourceLockedError)
+        self.assertEqual(response.status, 423)
+
+    def test_charset_no_header(self):
         response = self._makeOne(body='foo')
-        self.assertEqual(response.headers.get('content-type'), 'text/plain; 
charset=iso-8859-15')
+        self.assertEqual(response.headers.get('content-type'),
+                         'text/plain; charset=iso-8859-15')
 
-    def test_CharsetTextHeader(self):
-        response = self._makeOne(body='foo', headers={'content-type': 
'text/plain'})
-        self.assertEqual(response.headers.get('content-type'), 'text/plain; 
charset=iso-8859-15')
+    def test_charset_text_header(self):
+        response = self._makeOne(body='foo',
+                    headers={'content-type': 'text/plain'})
+        self.assertEqual(response.headers.get('content-type'),
+                         'text/plain; charset=iso-8859-15')
 
-    def test_CharsetApplicationHeader(self):
-        response = self._makeOne(body='foo', headers={'content-type': 
'application/foo'})
-        self.assertEqual(response.headers.get('content-type'), 
'application/foo; charset=iso-8859-15')
+    def test_charset_application_header(self):
+        response = self._makeOne(body='foo',
+                    headers={'content-type': 'application/foo'})
+        self.assertEqual(response.headers.get('content-type'),
+                         'application/foo; charset=iso-8859-15')
     
-    def test_CharsetApplicationHeaderUnicode(self):
-        response = self._makeOne(body=unicode('ärger', 'iso-8859-15'), 
headers={'content-type': 'application/foo'})
-        self.assertEqual(response.headers.get('content-type'), 
'application/foo; charset=iso-8859-15')
+    def test_charset_application_header_unicode(self):
+        response = self._makeOne(body=unicode('ärger', 'iso-8859-15'),
+                    headers={'content-type': 'application/foo'})
+        self.assertEqual(response.headers.get('content-type'),
+                         'application/foo; charset=iso-8859-15')
         self.assertEqual(response.body, 'ärger')
 
-    def test_CharsetApplicationHeader1Unicode(self):
-        response = self._makeOne(body=unicode('ärger', 'iso-8859-15'), 
headers={'content-type': 'application/foo; charset=utf-8'})
-        self.assertEqual(response.headers.get('content-type'), 
'application/foo; charset=utf-8')
-        self.assertEqual(response.body, unicode('ärger', 
'iso-8859-15').encode('utf-8'))
+    def test_charset_application_header_unicode_1(self):
+        response = self._makeOne(body=unicode('ärger', 'iso-8859-15'),
+                    headers={'content-type': 'application/foo; charset=utf-8'})
+        self.assertEqual(response.headers.get('content-type'),
+                         'application/foo; charset=utf-8')
+        self.assertEqual(response.body, unicode('ärger',
+                         'iso-8859-15').encode('utf-8'))
 
     def test_XMLEncodingRecoding(self):
         xml = u'<?xml version="1.0" encoding="iso-8859-15" 
?>\n<foo><bar/></foo>'

_______________________________________________
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins

Reply via email to