Did I find the right examples for you? yes no

All Samples(3)  |  Call(1)  |  Derive(0)  |  Import(2)
Import a dotted module path and return the attribute/class designated by the
last name in the path. Raise ImproperlyConfigured if something goes wrong.

        def import_by_path(dotted_path, error_prefix=''):
    """
    Import a dotted module path and return the attribute/class designated by the
    last name in the path. Raise ImproperlyConfigured if something goes wrong.
    """
    try:
        module_path, class_name = dotted_path.rsplit('.', 1)
    except ValueError:
        raise ImproperlyConfigured("%s%s doesn't look like a module path" % (
            error_prefix, dotted_path))

    module = import_module(module_path)

    try:
        attr = getattr(module, class_name)
    except AttributeError:
        raise ImproperlyConfigured('%sModule "%s" does not define a "%s" attribute/class' % (
            error_prefix, module_path, class_name))
    return attr
        


src/d/j/django-admin-oauth2-0.2.1/oauthadmin/middleware.py   django-admin-oauth2(Download)
from time import time
from oauthadmin.utils import import_by_path
from oauthadmin.settings import app_setting
from oauthadmin.views import destroy_session
 
                    request,
                    app_setting('PING_INTERVAL'),
                    import_by_path(app_setting('PING'))
                )
 

src/d/j/django-admin-oauth2-0.2.1/oauthadmin/views.py   django-admin-oauth2(Download)
from django.core.urlresolvers import reverse
 
from oauthadmin.utils import import_by_path
from oauthadmin.settings import app_setting