def generate(self, rsp, canonicalize=None): def noop_canonicalize(url, method='GET'): return url canonicalize = func_update(noop_canonicalize, canonicalize) return {'canonicalize': canonicalize, 'canonical_uri': canonicalize(self.req.path)}
def generate(self, rsp, map_adapter, canonicalize=None): def werkzeug_canonicalize(url, method='GET'): c_endpoint, c_args = map_adapter.match(url, method) return map_adapter.build(c_endpoint, c_args, method) canonicalize = func_update(werkzeug_canonicalize, canonicalize) return {'canonicalize': canonicalize, 'canonical_uri': canonicalize(self.req.path)}