Did I find the right examples for you? yes no

All Samples(1)  |  Call(0)  |  Derive(0)  |  Import(1)

        def url_to_class(url, class_type=object):
    path = url
    if path.startswith('/'):
        path = path[1:]
    if path.endswith('/'):
        path = path[:-1]
    path = path.replace('/', '.')
    args = []
    while path.rfind('.') >= 0:
        arg = path[path.rfind('.') + 1:]
        path = path[0:path.rfind('.')]
            module = import_module(path)
            if not hasattr(module, arg):
                raise AttributeError("Class '%s' is not found in module '%s'." % (arg, path))
            cls = getattr(module, arg)
            if not inspect.isclass(cls):
                raise AttributeErrorError("Object '%s' is not a class." % repr(cls))
            if not issubclass(cls, class_type):
                raise AttributeError("Class '%s' is not a descendant of the '%s' class." % (cls.__name__, class_type.__name__))
            if len(args) > 0:
            return cls, tuple(args), '.'.join((path, cls.__name__))
        except ImportError, ex:
    raise ImportError("Module not found in path '%s'" % url)

src/e/n/enre-0.3.4/enre/views/__init__.py   enre(Download)
# -*- coding: utf-8 -*- 
from views import NoCacheMixin, ScriptView, AjaxView
from utils import url_to_class