2013-07-11 15:17:12 |
dick.fickling |
description |
If the Document object is created without a root element, its overridden version of __str__ throws an exception.
I encountered this bug with an interaction between the django debug toolbar and suds. In suds's suds.mx.core.append method, log.debug() can be called with a Document that has no children. Django's debug toolbar calls str() on the arguments to debug(), which causes the exception to be raised.
Reproduce:
import suds
str(suds.sax.document.Document())
Fix:
replace str and plain definitions with the code below:
def str(self):
s = []
s.append(self.DECL)
s.append('\n')
root = self.root()
if root is not None:
s.append(root.str())
return ''.join(s)
def plain(self):
s = []
s.append(self.DECL)
root = self.root()
if root is not None:
s.append(root.plain())
return ''.join(s)
Affects:
All versions of Ubuntu, all versions of suds |
If the Document object is created without a root element, its overridden version of __str__ throws an exception.
I encountered this bug with an interaction between the django debug toolbar and suds. In suds's suds.mx.core.append method, log.debug() can be called with a Document that has no children. Django's debug toolbar calls str() on the arguments to debug(), which causes the exception to be raised.
Reproduce:
import suds
str(suds.sax.document.Document())
Fix:
replace str and plain definitions in suds.sax.document.Document with the code below:
def str(self):
s = []
s.append(self.DECL)
s.append('\n')
root = self.root()
if root is not None:
s.append(root.str())
return ''.join(s)
def plain(self):
s = []
s.append(self.DECL)
root = self.root()
if root is not None:
s.append(root.plain())
return ''.join(s)
Affects:
All versions of Ubuntu, all versions of suds |
|