예제 #1
0
파일: auth.py 프로젝트: smulloni/satimol
def enable():
    """
    install the auth service.  
    """
    from skunk.web.context import InitContextHook
    if not _auth_hook in InitContextHook:
        InitContextHook.append(_auth_hook)
예제 #2
0
파일: routing.py 프로젝트: smulloni/satimol
        elif isinstance(r, (list, tuple)):
            if (len(r)==2 and
                isinstance(r[0], (list, tuple)) and
                isinstance(r[1], dict)):
                map.connect(*r[0], **r[1])
            else:
                map.connect(*r)
        else:
            raise ValueError, "wrong arguments for connect()"

    map.create_regs(list(Configuration.controllers))
    context.routes_mapper=map
    request_config().redirect=_redirect

# initial the mapper in the context middleware
InitContextHook.append(initMapper)

class RoutingMiddleware(routes.middleware.RoutesMiddleware):
    """
    trivial subclass of routes' own middleware
    """

    def __init__(self, app, use_method_override=False, path_info=True):
        super(RoutingMiddleware, self).__init__(app,
                                                None,
                                                use_method_override,
                                                path_info)

    def mapper():
        def fget(self):
            return Context.routes_mapper
예제 #3
0
파일: base.py 프로젝트: smulloni/satimol
def enable():
    if not _init_session_hook in InitContextHook:
        InitContextHook.append(_init_session_hook)
    if not _session_cleanup_hook in CleanupContextHook:
        CleanupContextHook.append(_session_cleanup_hook)