コード例 #1
0
ファイル: testing.py プロジェクト: jvanasco/pyramid
 def __call__(self, request):
     path = decode_path_info(request.environ['PATH_INFO'])
     ob = resources[path]
     traversed = split_path_info(path)
     return {'context':ob, 'view_name':'','subpath':(),
             'traversed':traversed, 'virtual_root':ob,
             'virtual_root_path':(), 'root':ob}
コード例 #2
0
 def __call__(self, request):
     path = decode_path_info(request.environ['PATH_INFO'])
     ob = resources[path]
     traversed = split_path_info(path)
     return {'context':ob, 'view_name':'','subpath':(),
             'traversed':traversed, 'virtual_root':ob,
             'virtual_root_path':(), 'root':ob}
コード例 #3
0
    def __call__(self, request):
        environ = request.environ
        try:
            # empty if mounted under a path in mod_wsgi, for example
            path = decode_path_info(environ['PATH_INFO'] or '/')
        except KeyError:
            path = '/'
        except UnicodeDecodeError as e:
            raise URLDecodeError(e.encoding, e.object, e.start, e.end, e.reason)

        for route in self.routelist:
            match = route.match(path)
            if match is not None:
                preds = route.predicates
                info = {'match':match, 'route':route}
                if preds and not all((p(info, request) for p in preds)):
                    continue
                return info

        return {'route':None, 'match':None}
コード例 #4
0
ファイル: urldispatch.py プロジェクト: casics/extractor
    def __call__(self, request):
        environ = request.environ
        try:
            # empty if mounted under a path in mod_wsgi, for example
            path = decode_path_info(environ['PATH_INFO'] or '/')
        except KeyError:
            path = '/'
        except UnicodeDecodeError as e:
            raise URLDecodeError(e.encoding, e.object, e.start, e.end,
                                 e.reason)

        for route in self.routelist:
            match = route.match(path)
            if match is not None:
                preds = route.predicates
                info = {'match': match, 'route': route}
                if preds and not all((p(info, request) for p in preds)):
                    continue
                return info

        return {'route': None, 'match': None}