Skip to content

Commit

Permalink
Make fakelibvirt python2.6 compatible
Browse files Browse the repository at this point in the history
Fix bug #893757. In Python 2.6 xml.etree.ElementTree.fromstring
raises xml.parsers.expat.ExpatError instead of
xml.etree.ElementTree.ParseError when faced with invalid xml.
Adjust accordingly.

Change-Id: I1e4ae532e001618bded2b60e554915e5d6f7e038
  • Loading branch information
sorenisanerd committed Nov 22, 2011
1 parent 6b0fff1 commit b6ae26b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion nova/tests/fakelibvirt.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
# under the License.

from xml.etree.ElementTree import fromstring as xml_to_tree
from xml.etree.ElementTree import ParseError
try:
from xml.etree.ElementTree import ParseError
except ImportError:
from xml.parsers.expat import ExpatError as ParseError

import uuid

# Allow passing None to the various connect methods
Expand Down

0 comments on commit b6ae26b

Please sign in to comment.