def view_lookup(request, uri):
 api_prefix = ('/%s' % request.upath_info.split('/')[1])
 path = _encoded((api_prefix + uri))
 q = request.registry.queryUtility
 routes_mapper = q(IRoutesMapper)
 fakerequest = Request.blank(path=path)
 info = routes_mapper(fakerequest)
 (matchdict, route) = (info['match'], info['route'])
 if (route is None):
  raise ValueError('URI has no route')
 resource_name = route.name.replace('-record', '').replace('-collection', '')
 return (resource_name, matchdict)

def view_lookup ( request , uri ) : api_prefix = ( '/%s' % request . upath_info . split ( '/' ) [ 1 ] ) path = _encoded ( ( api_prefix + uri ) ) q = request . registry . queryUtility routes_mapper = q ( IRoutesMapper ) fakerequest = Request . blank ( path = path ) info = routes_mapper ( fakerequest ) ( matchdict , route ) = ( info [ 'match' ] , info [ 'route' ] ) if ( route is None ) : raise ValueError ( 'URI has no route' ) resource_name = route . name . replace ( '-record' , '' ) . replace ( '-collection' , '' ) return ( resource_name , matchdict )
look-up the specified uri and return the associated resource name along the match dict .