Fix python 2.5 specific code (Andrew Gillies)

This commit is contained in:
Cole Robinson 2008-09-22 10:51:07 -04:00
parent b315e56e4c
commit fac9e9997a
2 changed files with 7 additions and 5 deletions

View File

@ -46,6 +46,7 @@ Further patches have been submitted by:
S. Çağlar Onur <caglar-at-pardus-dot-org-dot-tr>
Claes Strom <cs-at-clabbe-dot-com>
Mike MacCana <mmaccana-at-au1-dot-ibm-dot-com>
Andrew Gillies <anaru-at-main-dot-com>
<...send a patch & get your name here...>

View File

@ -661,11 +661,12 @@ class vmmDomain(gobject.GObject):
ctx = None
ret = []
try:
doc = libxml2.parseDoc(self.get_xml())
ctx = doc.xpathNewContext()
ret = parse_function(ctx)
except Exception, e:
logging.debug("Error parsing domain xml: %s" % str(e))
try:
doc = libxml2.parseDoc(self.get_xml())
ctx = doc.xpathNewContext()
ret = parse_function(ctx)
except Exception, e:
logging.debug("Error parsing domain xml: %s" % str(e))
finally:
if ctx:
ctx.xpathFreeContext()