[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/ Repaired 'handle_errors' usage for doctests, along with the supporting

2005-09-24 Thread Tres Seaver
Log message for revision 38599:
  Repaired 'handle_errors' usage for doctests, along with the supporting
  'debug' argument passed to 'ZPublisher.Test.publish_module'.
  
  

Changed:
  U   Zope/branches/Zope-2_8-branch/doc/CHANGES.txt
  U   
Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/zopedoctest/functional.py
  U   Zope/branches/Zope-2_8-branch/lib/python/ZPublisher/Test.py

-=-
Modified: Zope/branches/Zope-2_8-branch/doc/CHANGES.txt
===
--- Zope/branches/Zope-2_8-branch/doc/CHANGES.txt   2005-09-24 17:27:37 UTC 
(rev 38598)
+++ Zope/branches/Zope-2_8-branch/doc/CHANGES.txt   2005-09-24 17:35:59 UTC 
(rev 38599)
@@ -31,6 +31,10 @@
 
 Bugs Fixed
 
+  - Repaired 'handle_errors' usage for doctests, along with the
+supporting 'debug' argument passed to
+'ZPublisher.Test.publish_module'.
+
   - Collector #1879: applied patch by Dieter Maurer to fix a bug in 
 ac_aquire() ignoring the default argument
 

Modified: 
Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/zopedoctest/functional.py
===
--- 
Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/zopedoctest/functional.py
 2005-09-24 17:27:37 UTC (rev 38598)
+++ 
Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/zopedoctest/functional.py
 2005-09-24 17:35:59 UTC (rev 38599)
@@ -12,7 +12,7 @@
 ##
 """Support for (functional) doc tests
 
-$Id: functional.py,v 1.2 2005/03/26 18:07:08 shh42 Exp $
+$Id$
 """
 
 import sys, re, base64
@@ -176,7 +176,9 @@
 
 publish_module('Zope2', stdin=instream,
response=response,
-   environ=env)
+   environ=env,
+   debug=not handle_errors,
+  )
 header_output.setResponseStatus(response.getStatus(), response.errmsg)
 header_output.setResponseHeaders(response.headers)
 

Modified: Zope/branches/Zope-2_8-branch/lib/python/ZPublisher/Test.py
===
--- Zope/branches/Zope-2_8-branch/lib/python/ZPublisher/Test.py 2005-09-24 
17:27:37 UTC (rev 38598)
+++ Zope/branches/Zope-2_8-branch/lib/python/ZPublisher/Test.py 2005-09-24 
17:35:59 UTC (rev 38599)
@@ -199,6 +199,8 @@
 else: must_die=sys.exc_info()
 response.exception(1, v)
 except:
+if debug:
+raise
 response.exception()
 status=response.getStatus()
 if response:

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


[Zope-Checkins] SVN: Zope/trunk/ - Collector #1879: applied patch by Dieter Maurer to fix a bug in

2005-09-24 Thread Andreas Jung
Log message for revision 38587:
  
- Collector #1879: applied patch by Dieter Maurer to fix a bug in 
  ac_aquire() ignoring the default argument
  

Changed:
  U   Zope/trunk/doc/CHANGES.txt
  U   Zope/trunk/lib/python/Acquisition/_Acquisition.c

-=-
Modified: Zope/trunk/doc/CHANGES.txt
===
--- Zope/trunk/doc/CHANGES.txt  2005-09-24 12:10:07 UTC (rev 38586)
+++ Zope/trunk/doc/CHANGES.txt  2005-09-24 12:11:13 UTC (rev 38587)
@@ -42,6 +42,9 @@
 
 Bugs Fixed
 
+  - Collector #1879: applied patch by Dieter Maurer to fix a bug in 
+ac_aquire() ignoring the default argument
+
   - Collector #1864, #1906: fixed header normalization in appendHeader()
 
   - Collector #1899: fixed migration issue when using export/import for

Modified: Zope/trunk/lib/python/Acquisition/_Acquisition.c
===
--- Zope/trunk/lib/python/Acquisition/_Acquisition.c2005-09-24 12:10:07 UTC 
(rev 38586)
+++ Zope/trunk/lib/python/Acquisition/_Acquisition.c2005-09-24 12:11:13 UTC 
(rev 38587)
@@ -1059,6 +1059,7 @@
   PyObject *expl=0, *defalt=0;
   int explicit=1;
   int containment=0;
+  PyObject *result; /* DM 2005-08-25: argument "default" ignored */
 
   UNLESS (PyArg_ParseTupleAndKeywords(
 args, kw, "O|i", acquire_args+1,
@@ -1070,12 +1071,34 @@
 
   if (filter==Py_None) filter=0;
 
+  /* DM 2005-08-25: argument "default" ignored -- fix it! */
+# if 0
   return Wrapper_findattr(self,name,filter,extra,OBJECT(self),1,
  explicit || 
  self->ob_type==(PyTypeObject*)&Wrappertype,
  explicit, containment);
+# else
+  result = Wrapper_findattr(self,name,filter,extra,OBJECT(self),1,
+ explicit || 
+ self->ob_type==(PyTypeObject*)&Wrappertype,
+ explicit, containment);
+  if (result == NULL && defalt != NULL) {
+/* as "Python/bltinmodule.c:builtin_getattr" turn
+   only 'AttributeError' into a default value, such
+   that e.g. "ConflictError" and errors raised by the filter
+   are not mapped to the default value.
+*/
+if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
+  PyErr_Clear();
+  Py_INCREF(defalt);
+  result = defalt;
+}
+  }
+  return result;
+# endif
 }
 
+
 static PyObject *
 Wrapper_inContextOf(Wrapper *self, PyObject *args)
 {

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


[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/ - Collector #1879: applied patch by Dieter Maurer to fix a bug in

2005-09-24 Thread Andreas Jung
Log message for revision 38586:
- Collector #1879: applied patch by Dieter Maurer to fix a bug in 
  ac_aquire() ignoring the default argument
  

Changed:
  U   Zope/branches/Zope-2_8-branch/doc/CHANGES.txt
  U   Zope/branches/Zope-2_8-branch/lib/python/Acquisition/_Acquisition.c

-=-
Modified: Zope/branches/Zope-2_8-branch/doc/CHANGES.txt
===
--- Zope/branches/Zope-2_8-branch/doc/CHANGES.txt   2005-09-24 12:01:37 UTC 
(rev 38585)
+++ Zope/branches/Zope-2_8-branch/doc/CHANGES.txt   2005-09-24 12:10:07 UTC 
(rev 38586)
@@ -31,6 +31,9 @@
 
 Bugs Fixed
 
+  - Collector #1879: applied patch by Dieter Maurer to fix a bug in 
+ac_aquire() ignoring the default argument
+
   - Collector #1864, #1906: fixed header normalization in appendHeader()
 
   - Collector #1899: fixed migration issue when using export/import for

Modified: Zope/branches/Zope-2_8-branch/lib/python/Acquisition/_Acquisition.c
===
--- Zope/branches/Zope-2_8-branch/lib/python/Acquisition/_Acquisition.c 
2005-09-24 12:01:37 UTC (rev 38585)
+++ Zope/branches/Zope-2_8-branch/lib/python/Acquisition/_Acquisition.c 
2005-09-24 12:10:07 UTC (rev 38586)
@@ -1059,6 +1059,7 @@
   PyObject *expl=0, *defalt=0;
   int explicit=1;
   int containment=0;
+  PyObject *result; /* DM 2005-08-25: argument "default" ignored */
 
   UNLESS (PyArg_ParseTupleAndKeywords(
 args, kw, "O|i", acquire_args+1,
@@ -1070,12 +1071,34 @@
 
   if (filter==Py_None) filter=0;
 
+  /* DM 2005-08-25: argument "default" ignored -- fix it! */
+# if 0
   return Wrapper_findattr(self,name,filter,extra,OBJECT(self),1,
  explicit || 
  self->ob_type==(PyTypeObject*)&Wrappertype,
  explicit, containment);
+# else
+  result = Wrapper_findattr(self,name,filter,extra,OBJECT(self),1,
+ explicit || 
+ self->ob_type==(PyTypeObject*)&Wrappertype,
+ explicit, containment);
+  if (result == NULL && defalt != NULL) {
+/* as "Python/bltinmodule.c:builtin_getattr" turn
+   only 'AttributeError' into a default value, such
+   that e.g. "ConflictError" and errors raised by the filter
+   are not mapped to the default value.
+*/
+if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
+  PyErr_Clear();
+  Py_INCREF(defalt);
+  result = defalt;
+}
+  }
+  return result;
+# endif
 }
 
+
 static PyObject *
 Wrapper_inContextOf(Wrapper *self, PyObject *args)
 {

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


[Zope-Checkins] CVS: Packages/ZPublisher - HTTPResponse.py:1.75.2.10

2005-09-24 Thread Andreas Jung
Update of /cvs-repository/Packages/ZPublisher
In directory cvs.zope.org:/tmp/cvs-serv25453/lib/python/ZPublisher

Modified Files:
  Tag: Zope-2_7-branch
HTTPResponse.py 
Log Message:
Collector #1864, #1906: fixed header normalization in appendHeader()


=== Packages/ZPublisher/HTTPResponse.py 1.75.2.9 => 1.75.2.10 ===
--- Packages/ZPublisher/HTTPResponse.py:1.75.2.9Wed Dec 22 10:51:28 2004
+++ Packages/ZPublisher/HTTPResponse.py Sat Sep 24 06:37:19 2005
@@ -533,7 +533,7 @@
 Sets an HTTP return header "name" with value "value",
 appending it following a comma if there was a previous value
 set for the header. '''
-name = str(name)
+name = str(name).lower()
 value = str(value)
 
 headers = self.headers

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


[Zope-Checkins] CVS: Zope/doc - CHANGES.txt:1.625.2.355

2005-09-24 Thread Andreas Jung
Update of /cvs-repository/Zope/doc
In directory cvs.zope.org:/tmp/cvs-serv25453/doc

Modified Files:
  Tag: Zope-2_7-branch
CHANGES.txt 
Log Message:
Collector #1864, #1906: fixed header normalization in appendHeader()


=== Zope/doc/CHANGES.txt 1.625.2.354 => 1.625.2.355 ===
--- Zope/doc/CHANGES.txt:1.625.2.354Fri Sep 16 10:24:43 2005
+++ Zope/doc/CHANGES.txtSat Sep 24 06:37:18 2005
@@ -13,6 +13,8 @@
 
 Bugs fixed
 
+  - Collector #1864, #1906: fixed header normalization in appendHeader()
+
   - Collector #1815: ZCTextIndex.index_object() now handles either
 strings or lists of strings.
 

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


[Zope-Checkins] CVS: Packages/ZPublisher/tests - testHTTPResponse.py:1.1.4.3

2005-09-24 Thread Andreas Jung
Update of /cvs-repository/Packages/ZPublisher/tests
In directory cvs.zope.org:/tmp/cvs-serv25453/lib/python/ZPublisher/tests

Modified Files:
  Tag: Zope-2_7-branch
testHTTPResponse.py 
Log Message:
Collector #1864, #1906: fixed header normalization in appendHeader()


=== Packages/ZPublisher/tests/testHTTPResponse.py 1.1.4.2 => 1.1.4.3 ===
--- Packages/ZPublisher/tests/testHTTPResponse.py:1.1.4.2   Mon Apr 26 
06:11:24 2004
+++ Packages/ZPublisher/tests/testHTTPResponse.py   Sat Sep 24 06:37:19 2005
@@ -65,6 +65,16 @@
 self.assertEqual(cookie.get('value'), 'bar:baz')
 self.assertEqual(cookie.get('path'), '/')
 
+def test_appendHeader(self):
+response = self._makeOne()
+response.setHeader('foo', 'bar')
+response.appendHeader('foo', 'foo')
+self.assertEqual(response.headers.get('foo'), 'bar,\n\tfoo')
+response.setHeader('xxx', 'bar')
+response.appendHeader('XXX', 'foo')
+self.assertEqual(response.headers.get('xxx'), 'bar,\n\tfoo')
+
+
 def test_suite():
 suite = unittest.TestSuite()
 suite.addTest(unittest.makeSuite(HTTPResponseTests, 'test'))

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


[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/ Collector #1864, #1906: fixed header normalization in appendHeader()

2005-09-24 Thread Andreas Jung
Log message for revision 38584:
  
  Collector #1864, #1906: fixed header normalization in appendHeader()
  

Changed:
  U   Zope/branches/Zope-2_8-branch/doc/CHANGES.txt
  U   Zope/branches/Zope-2_8-branch/lib/python/ZPublisher/HTTPResponse.py
  U   
Zope/branches/Zope-2_8-branch/lib/python/ZPublisher/tests/testHTTPResponse.py

-=-
Modified: Zope/branches/Zope-2_8-branch/doc/CHANGES.txt
===
--- Zope/branches/Zope-2_8-branch/doc/CHANGES.txt   2005-09-24 10:24:16 UTC 
(rev 38583)
+++ Zope/branches/Zope-2_8-branch/doc/CHANGES.txt   2005-09-24 10:34:48 UTC 
(rev 38584)
@@ -31,6 +31,8 @@
 
 Bugs Fixed
 
+  - Collector #1864, #1906: fixed header normalization in appendHeader()
+
   - Collector #1899: fixed migration issue when using export/import for
 ZCatalog instances
 

Modified: Zope/branches/Zope-2_8-branch/lib/python/ZPublisher/HTTPResponse.py
===
--- Zope/branches/Zope-2_8-branch/lib/python/ZPublisher/HTTPResponse.py 
2005-09-24 10:24:16 UTC (rev 38583)
+++ Zope/branches/Zope-2_8-branch/lib/python/ZPublisher/HTTPResponse.py 
2005-09-24 10:34:48 UTC (rev 38584)
@@ -544,7 +544,7 @@
 Sets an HTTP return header "name" with value "value",
 appending it following a comma if there was a previous value
 set for the header. '''
-name = str(name)
+name = str(name).lower()
 value = str(value)
 
 headers = self.headers

Modified: 
Zope/branches/Zope-2_8-branch/lib/python/ZPublisher/tests/testHTTPResponse.py
===
--- 
Zope/branches/Zope-2_8-branch/lib/python/ZPublisher/tests/testHTTPResponse.py   
2005-09-24 10:24:16 UTC (rev 38583)
+++ 
Zope/branches/Zope-2_8-branch/lib/python/ZPublisher/tests/testHTTPResponse.py   
2005-09-24 10:34:48 UTC (rev 38584)
@@ -65,6 +65,16 @@
 self.assertEqual(cookie.get('value'), 'bar:baz')
 self.assertEqual(cookie.get('path'), '/')
 
+def test_appendHeader(self):
+response = self._makeOne()
+response.setHeader('foo', 'bar')
+response.appendHeader('foo', 'foo')
+self.assertEqual(response.headers.get('foo'), 'bar,\n\tfoo')
+response.setHeader('xxx', 'bar')
+response.appendHeader('XXX', 'foo')
+self.assertEqual(response.headers.get('xxx'), 'bar,\n\tfoo')
+
+
 def test_suite():
 suite = unittest.TestSuite()
 suite.addTest(unittest.makeSuite(HTTPResponseTests, 'test'))

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


[Zope-Checkins] SVN: Zope/trunk/doc/CHANGES.txt Collector #1864, #1906: fixed header normalization in appendHeader()

2005-09-24 Thread Andreas Jung
Log message for revision 38583:
  
  Collector #1864, #1906: fixed header normalization in appendHeader()
  

Changed:
  U   Zope/trunk/doc/CHANGES.txt

-=-
Modified: Zope/trunk/doc/CHANGES.txt
===
--- Zope/trunk/doc/CHANGES.txt  2005-09-24 10:23:19 UTC (rev 38582)
+++ Zope/trunk/doc/CHANGES.txt  2005-09-24 10:24:16 UTC (rev 38583)
@@ -42,6 +42,8 @@
 
 Bugs Fixed
 
+  - Collector #1864, #1906: fixed header normalization in appendHeader()
+
   - Collector #1899: fixed migration issue when using export/import for
 ZCatalog instances
 

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


[Zope-Checkins] SVN: Zope/trunk/lib/python/ZPublisher/ Collector #1864, #1906: fixed header normalization in appendHeader()

2005-09-24 Thread Andreas Jung
Log message for revision 38582:
  Collector #1864, #1906: fixed header normalization in appendHeader()
  

Changed:
  U   Zope/trunk/lib/python/ZPublisher/HTTPResponse.py
  U   Zope/trunk/lib/python/ZPublisher/tests/testHTTPResponse.py

-=-
Modified: Zope/trunk/lib/python/ZPublisher/HTTPResponse.py
===
--- Zope/trunk/lib/python/ZPublisher/HTTPResponse.py2005-09-24 10:06:12 UTC 
(rev 38581)
+++ Zope/trunk/lib/python/ZPublisher/HTTPResponse.py2005-09-24 10:23:19 UTC 
(rev 38582)
@@ -544,7 +544,7 @@
 Sets an HTTP return header "name" with value "value",
 appending it following a comma if there was a previous value
 set for the header. '''
-name = str(name)
+name = str(name).lower()
 value = str(value)
 
 headers = self.headers

Modified: Zope/trunk/lib/python/ZPublisher/tests/testHTTPResponse.py
===
--- Zope/trunk/lib/python/ZPublisher/tests/testHTTPResponse.py  2005-09-24 
10:06:12 UTC (rev 38581)
+++ Zope/trunk/lib/python/ZPublisher/tests/testHTTPResponse.py  2005-09-24 
10:23:19 UTC (rev 38582)
@@ -65,6 +65,16 @@
 self.assertEqual(cookie.get('value'), 'bar:baz')
 self.assertEqual(cookie.get('path'), '/')
 
+def test_appendHeader(self):
+response = self._makeOne()
+response.setHeader('foo', 'bar')
+response.appendHeader('foo', 'foo')
+self.assertEqual(response.headers.get('foo'), 'bar,\n\tfoo')
+response.setHeader('xxx', 'bar')
+response.appendHeader('XXX', 'foo')
+self.assertEqual(response.headers.get('xxx'), 'bar,\n\tfoo')
+
+
 def test_suite():
 suite = unittest.TestSuite()
 suite.addTest(unittest.makeSuite(HTTPResponseTests, 'test'))

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