[XML-SIG] xml.marhshal.generic and new style classes

Mark English Mark.English at liffe.com
Fri Apr 29 18:53:04 CEST 2005

I may have missed this being addressed somewhere, but I'm having the
following problem.
The generic marshaller will not marshal new style classes. I've seen
reports of similar problems, but no solutions.
---start code---
For example:
>>> class WillWork:
...     pass
>>> class WontWork(object):
...     pass
>>> will = WillWork()
>>> wont = WontWork()
>>> import xml.marshal.generic
>>> xml.marshal.generic.dumps(will)
'<?xml version="1.0"?><marshal><object id="i2" module="__main__"
>>> xml.marshal.generic.dumps(wont)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "C:\Program
Files\Python24\Lib\site-packages\_xmlplus\marshal\generic.py", line 59,
in dumps
    L = [self.PROLOGUE + self.DTD] + self.m_root(value, dict)
  File "C:\Program
Files\Python24\Lib\site-packages\_xmlplus\marshal\generic.py", line 104,
in m_root
    L = ['<%s>' % name] + self._marshal(value,dict) + ['</%s>' % name]
  File "C:\Program
Files\Python24\Lib\site-packages\_xmlplus\marshal\generic.py", line 92,
in _marshal
    return getattr(self, meth)(value, dict)
AttributeError: Marshaller instance has no attribute 'm_WontWork'

---end code---
Has anyone found a fix for this, or is anything planned ? I've raised a
bug on sourceforge.

The information contained in this e-mail is confidential and solely 
for the intended addressee(s). Unauthorised reproduction, disclosure, 
modification, and/or distribution of this email may be unlawful. If you 
have received this email in error, please notify the sender immediately 
and delete it from your system. The views expressed in this message 
do not necessarily reflect those of LIFFE Holdings Plc or any of its subsidiary companies.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/xml-sig/attachments/20050429/34ceda38/attachment.htm

More information about the XML-SIG mailing list