On Fri, Oct 02, 2009 at 01:46:48PM -0400, Cole Robinson wrote: > xmllib has been deprecated since python 2.0, and running the generator throws > a warning. Move to using xml.sax > > Signed-off-by: Cole Robinson <crobinso@xxxxxxxxxx> > --- > python/generator.py | 23 +++++++++-------------- > 1 files changed, 9 insertions(+), 14 deletions(-) ACK, assuming xml.sax has been present since python 2.4 which is the minimum version we're able to build with. Daniel > > diff --git a/python/generator.py b/python/generator.py > index 3d142e9..9ec91d8 100755 > --- a/python/generator.py > +++ b/python/generator.py > @@ -25,32 +25,27 @@ else: > # > ####################################################################### > import os > -import xmllib > +import xml.sax > > debug = 0 > > -class SlowParser(xmllib.XMLParser): > - """slow but safe standard parser, based on the XML parser in > - Python's standard library.""" > - > - def __init__(self, target): > - self.unknown_starttag = target.start > - self.handle_data = target.data > - self.handle_cdata = target.cdata > - self.unknown_endtag = target.end > - xmllib.XMLParser.__init__(self) > - > def getparser(): > # Attach parser to an unmarshalling object. return both objects. > target = docParser() > - return SlowParser(target), target > + parser = xml.sax.make_parser() > + parser.setContentHandler(target) > + return parser, target > > -class docParser: > +class docParser(xml.sax.handler.ContentHandler): > def __init__(self): > self._methodname = None > self._data = [] > self.in_function = 0 > > + self.startElement = self.start > + self.endElement = self.end > + self.characters = self.data > + > def close(self): > if debug: > print "close" > -- > 1.6.5.rc2 > > -- > Libvir-list mailing list > Libvir-list@xxxxxxxxxx > https://www.redhat.com/mailman/listinfo/libvir-list -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| -- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list