~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/xml_serializer.py

(mbp) merge bzr.dev to 0.8, prepare for release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /usr/bin/env python
2
1
# -*- coding: UTF-8 -*-
3
2
 
4
3
# This program is free software; you can redistribute it and/or modify
29
28
    from cElementTree import (ElementTree, SubElement, Element,
30
29
                              XMLTreeBuilder, fromstring, tostring)
31
30
except ImportError:
32
 
    ## from warnings import warn
33
 
    ## warn('using slower ElementTree; consider installing cElementTree')
 
31
    mutter('WARNING: using slower ElementTree; consider installing cElementTree'
 
32
           " and make sure it's on your PYTHONPATH")
34
33
    from util.elementtree.ElementTree import (ElementTree, SubElement,
35
34
                                              Element, XMLTreeBuilder,
36
35
                                              fromstring, tostring)
46
45
        self._write_element(elt, f)
47
46
 
48
47
    def write_inventory_to_string(self, inv):
49
 
        return tostring(self._pack_inventory(inv))
 
48
        return tostring(self._pack_inventory(inv)) + '\n'
50
49
 
51
50
    def read_inventory_from_string(self, xml_string):
52
51
        return self._unpack_inventory(fromstring(xml_string))
58
57
        self._write_element(self._pack_revision(rev), f)
59
58
 
60
59
    def write_revision_to_string(self, rev):
61
 
        return tostring(self._pack_revision(rev), f)
 
60
        return tostring(self._pack_revision(rev)) + '\n'
62
61
 
63
62
    def read_revision(self, f):
64
63
        return self._unpack_revision(self._read_element(f))