~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/xml_serializer.py

  • Committer: Aaron Bentley
  • Date: 2007-06-26 19:31:00 UTC
  • mto: (2520.5.2 bzr.mpbundle)
  • mto: This revision was merged to the branch mainline in revision 2631.
  • Revision ID: abentley@panoramicfeedback.com-20070626193100-d6lhaut5mixlzw5r
Use a registry to look up xml serializers by format

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
# importing this module is fairly slow because it has to load several
23
23
# ElementTree bits
24
24
 
 
25
from bzrlib import registry
25
26
from bzrlib.trace import mutter, warning
26
27
 
27
28
try:
155
156
        elementtree.ElementTree._raise_serialization_error(text)
156
157
 
157
158
elementtree.ElementTree._escape_cdata = _escape_cdata
 
159
 
 
160
 
 
161
class SerializerRegistry(registry.Registry):
 
162
    """Registry for serializer objects"""
 
163
 
 
164
 
 
165
format_registry = SerializerRegistry()
 
166
format_registry.register_lazy('4', 'bzrlib.xml4', 'serializer_v4')
 
167
format_registry.register_lazy('5', 'bzrlib.xml5', 'serializer_v5')
 
168
format_registry.register_lazy('6', 'bzrlib.xml6', 'serializer_v6')
 
169
format_registry.register_lazy('7', 'bzrlib.xml7', 'serializer_v7')