~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/xml_serializer.py

  • Committer: John Arbash Meinel
  • Date: 2006-09-23 06:39:46 UTC
  • mfrom: (2034 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2035.
  • Revision ID: john@arbash-meinel.com-20060923063946-e596c8a8eef928b4
[merge] bzr.dev 2034

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
    from cElementTree import (ElementTree, SubElement, Element,
29
29
                              XMLTreeBuilder, fromstring, tostring)
30
30
    import elementtree
 
31
    ParseError = SyntaxError
31
32
except ImportError:
32
33
    mutter('WARNING: using slower ElementTree; consider installing cElementTree'
33
34
           " and make sure it's on your PYTHONPATH")
35
36
                                              Element, XMLTreeBuilder,
36
37
                                              fromstring, tostring)
37
38
    import util.elementtree as elementtree
 
39
    from xml.parsers.expat import ExpatError as ParseError
38
40
 
39
41
from bzrlib import errors
40
42
 
52
54
    def read_inventory_from_string(self, xml_string):
53
55
        try:
54
56
            return self._unpack_inventory(fromstring(xml_string))
55
 
        except SyntaxError, e:
 
57
        except ParseError, e:
56
58
            raise errors.UnexpectedInventoryFormat(e)
57
59
 
58
60
    def read_inventory(self, f):
59
61
        try:
60
62
            return self._unpack_inventory(self._read_element(f))
61
 
        except SyntaxError, e:
 
63
        except ParseError, e:
62
64
            raise errors.UnexpectedInventoryFormat(e)
63
65
 
64
66
    def write_revision(self, rev, f):