/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/export/__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:
20
20
"""
21
21
 
22
22
import os
23
 
import bzrlib.errors as errors
 
23
from bzrlib import (
 
24
    errors,
 
25
    pyutils,
 
26
    )
24
27
 
25
28
# Maps format name => export function
26
29
_exporters = {}
55
58
    When requesting a specific type of export, load the respective path.
56
59
    """
57
60
    def _loader(tree, dest, root, subdir, filtered, per_file_timestamps):
58
 
        mod = __import__(module, globals(), locals(), [funcname])
59
 
        func = getattr(mod, funcname)
 
61
        func = pyutils.get_named_object(module, funcname)
60
62
        return func(tree, dest, root, subdir, filtered=filtered,
61
63
                    per_file_timestamps=per_file_timestamps)
62
64
    register_exporter(scheme, extensions, _loader)