def test_exportXML(self): from OFS.Folder import Folder from OFS.Image import Image from OFS.XMLExportImport import exportXML connection, app = self._makeJarAndRoot() data = open(imagedata, 'rb') sub = Folder('sub') app._setObject('sub', sub) img = Image('image', '', data, 'image/gif') sub._setObject('image', img) img._setProperty('prop1', 3.14159265359, 'float') img._setProperty('prop2', 1, 'int') img._setProperty('prop3', 2L**31-1, 'long') img._setProperty('prop4', 'xxx', 'string') img._setProperty('prop5', ['xxx', 'zzz'], 'lines') img._setProperty('prop6', u'xxx', 'unicode') img._setProperty('prop7', [u'xxx', u'zzz'], 'ulines') img._setProperty('prop8', '<&>', 'string') img._setProperty('prop9', u'<&>', 'unicode') img._setProperty('prop10', '<]]>', 'string') img._setProperty('prop11', u'<]]>', 'unicode') img._setProperty('prop12', u'£', 'unicode') transaction.savepoint(optimistic=True) oid = sub._p_oid handle, path = tempfile.mkstemp(suffix='.xml') try: ostream = os.fdopen(handle,'wb') data = exportXML(connection, oid, ostream) ostream.close() finally: os.remove(path)