1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-30 22:43:14 +03:00

oops forgot to modify/commit the new code. Daniel

* python/libxml.py: oops forgot to modify/commit the new code.
Daniel
This commit is contained in:
Daniel Veillard
2003-12-04 14:12:05 +00:00
parent 6cbd6c0738
commit 85bb5b08df
2 changed files with 28 additions and 4 deletions

View File

@ -1,3 +1,7 @@
Thu Dec 4 15:10:57 CET 2003 Daniel Veillard <daniel@veillard.com>
* python/libxml.py: oops forgot to modify/commit the new code.
Thu Dec 4 13:29:19 CET 2003 Daniel Veillard <daniel@veillard.com> Thu Dec 4 13:29:19 CET 2003 Daniel Veillard <daniel@veillard.com>
* python/generator.py python/libxml.c python/libxml_wrap.h: * python/generator.py python/libxml.c python/libxml_wrap.h:

View File

@ -1,4 +1,5 @@
import libxml2mod import libxml2mod
import types
# #
# Errors raised by the wrappers when some tree handling failed. # Errors raised by the wrappers when some tree handling failed.
@ -79,18 +80,37 @@ class ioReadWrapper(ioWrapper):
class ioWriteWrapper(ioWrapper): class ioWriteWrapper(ioWrapper):
def __init__(self, _obj, enc = ""): def __init__(self, _obj, enc = ""):
ioWrapper.__init__(self, _obj) # print "ioWriteWrapper.__init__", _obj
self._o = libxml2mod.xmlCreateOutputBuffer(self, enc) if type(_obj) == type(''):
print "write io from a string"
self.o = None
elif type(_obj) == types.InstanceType:
print "write io from instance of %s" % (_obj.__class__)
ioWrapper.__init__(self, _obj)
self._o = libxml2mod.xmlCreateOutputBuffer(self, enc)
else:
file = libxml2mod.outputBufferGetPythonFile(_obj)
if file != None:
ioWrapper.__init__(self, file)
else:
ioWrapper.__init__(self, _obj)
self._o = _obj
def __del__(self): def __del__(self):
print "__del__" # print "__del__"
self.io_close() self.io_close()
if self._o != None: if self._o != None:
libxml2mod.xmlOutputBufferClose(self._o) libxml2mod.xmlOutputBufferClose(self._o)
self._o = None self._o = None
def flush(self):
self.io_flush()
if self._o != None:
libxml2mod.xmlOutputBufferClose(self._o)
self._o = None
def close(self): def close(self):
self.io_close() self.io_flush()
if self._o != None: if self._o != None:
libxml2mod.xmlOutputBufferClose(self._o) libxml2mod.xmlOutputBufferClose(self._o)
self._o = None self._o = None