/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/bundle/serializer/__init__.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-10-15 11:29:38 UTC
  • mfrom: (5499.1.1 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20101015112938-8585tdgvnin38kfv
(vila) Add bzrlib/pyutils.py,
        and replace uses of __import__ with calls to pyutils.get_named_object
        (Andrew Bennetts)

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
from StringIO import StringIO
22
22
import re
23
23
 
24
 
import bzrlib.errors as errors
 
24
from bzrlib import (
 
25
    errors,
 
26
    pyutils,
 
27
    )
25
28
from bzrlib.diff import internal_diff
26
29
from bzrlib.revision import NULL_REVISION
27
30
# For backwards-compatibility
191
194
    :param overwrite: Should this version override a default
192
195
    """
193
196
    def _loader(version):
194
 
        mod = __import__(module, globals(), locals(), [classname])
195
 
        klass = getattr(mod, classname)
 
197
        klass = pyutils.get_named_object(module, classname)
196
198
        return klass(version)
197
199
    register(version, _loader, overwrite=overwrite)
198
200