improvements

This commit is contained in:
2018-10-23 14:58:02 -04:00
parent 72f4227c5a
commit fb636028fb
2 changed files with 4 additions and 8 deletions
+2 -2
View File
@@ -474,7 +474,7 @@ class API:
elif route_object.endpoint_name == endpoint:
return route_object
def url_for(self, endpoint, testing=False, **params):
def url_for(self, endpoint, **params):
# TODO: Absolute_url
"""Given an endpoint, returns a rendered URL for its route.
@@ -483,7 +483,7 @@ class API:
"""
route_object = self._route_for(endpoint)
if route_object:
return route_object.url(testing=testing, **params)
return route_object.url(**params)
raise ValueError
def static_url(self, asset):
+2 -6
View File
@@ -57,12 +57,8 @@ class Route:
results = parse(self.route, s)
return results.named if results else {}
def url(self, testing=False, **params):
url = self.route.format(**params)
if testing:
url = f"http://;{url}"
return url
def url(self, **params):
return self.route.format(**params)
def _weight(self):
params = set(self._param_pattern.findall(self.route))