import_string package

Submodules

import_string.base module

exception import_string.base.ImportStringError(import_name, exception)[source]

Bases: exceptions.ImportError

Provides information about a failed import_string() attempt.

exception = None

Wrapped exception.

import_name = None

String in dotted notation that failed to be imported.

import_string.base.import_string(import_name, silent=False)[source]

Imports an object based on a string. This is useful if you want to use import paths as endpoints or something similar. An import path can be specified either in dotted notation (xml.sax.saxutils.escape) or with a colon as object delimiter (xml.sax.saxutils:escape). If silent is True the return value will be None if the import fails. :param import_name: the dotted name for the object to import. :param silent: if set to True import errors are ignored and

None is returned instead.
Returns:imported object
import_string.base.reraise(tp, value, tb=None)[source]

Module contents

Imports an object based on a string. This is useful if you want to use import paths as endpoints or something similar. An import path can be specified either in dotted notation (xml.sax.saxutils.escape) or with a colon as object delimiter (xml.sax.saxutils:escape). If silent is True the return value will be None if the import fails. :param import_name: the dotted name for the object to import. :param silent: if set to True import errors are ignored and

None is returned instead.
return:imported object