[Checkins] SVN: zope.webdav/trunk/src/zope/webdav/publisher.py Fixed bug with parsing an invalid XML request body - not all possible

Michael Kerrin michael.kerrin at openapp.biz
Wed Apr 4 14:33:36 EDT 2007


Log message for revision 74012:
  Fixed bug with parsing an invalid XML request body - not all possible
  exceptions were been caught and converted into BadRequests.
  

Changed:
  U   zope.webdav/trunk/src/zope/webdav/publisher.py

-=-
Modified: zope.webdav/trunk/src/zope/webdav/publisher.py
===================================================================
--- zope.webdav/trunk/src/zope/webdav/publisher.py	2007-04-04 18:24:58 UTC (rev 74011)
+++ zope.webdav/trunk/src/zope/webdav/publisher.py	2007-04-04 18:33:35 UTC (rev 74012)
@@ -15,16 +15,6 @@
 """
 __docformat__ = 'restructuredtext'
 
-import time
-import sys
-from xml.parsers.expat import ExpatError
-try:
-    from lxml.etree import XMLSyntaxError
-except ImportError:
-    # no lxml - so create a dummy excpetion
-    class XMLSyntaxError(Exception):
-        pass
-
 from zope import component
 from zope.interface import implements
 from zope.publisher.http import HTTPResponse, HTTPRequest
@@ -71,7 +61,9 @@
             etree = component.getUtility(IEtree)
             try:
                 self.xmlDataSource = etree.parse(self.bodyStream).getroot()
-            except (ExpatError, XMLSyntaxError):
+            except:
+                # There was an error parsing the body stream so this is a
+                # bad request.
                 raise interfaces.BadRequest(
                     self, u"Invalid xml data passed")
 



More information about the Checkins mailing list