Skip to content

Commit

Permalink
Updated list_routes
Browse files Browse the repository at this point in the history
  • Loading branch information
alwx committed Nov 5, 2021
1 parent 04c5a31 commit 44109ab
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 49 deletions.
84 changes: 38 additions & 46 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ typing-utils = "^0.1.0"
tarsafe = "^0.0.3"
randomname = "^0.1.5"
keras = "<2.7.0"
sanic-routing = { git = "https://github.com/wochinge/sanic-routing.git", branch = "fix-routing-with-multiple-path-params" }
sanic-routing = "0.7.2"

[tool.poetry.dev-dependencies]
pytest-cov = "^2.10.0"
Expand Down
5 changes: 3 additions & 2 deletions rasa/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,16 @@ def find_route(suffix: Text, path: Text) -> Optional[Text]:
options[arg] = f"[{arg}]"

if not isinstance(route.handler, CompositionView):
handlers = [(list(route.methods)[0], route.name.split(".")[-1])]
handlers = [(list(route.methods)[0], route.name.replace("rasa.server.", ""))]
else:
handlers = [
(method, find_route(v.__name__, endpoint) or v.__name__)
for method, v in route.handler.handlers.items()
]

for method, name in handlers:
line = unquote(f"{endpoint[0]:50s} {method:30s} {name}")
full_endpoint = "/" + "/".join(endpoint)
line = unquote(f"{full_endpoint:50s} {method:30s} {name}")
output[name] = line

url_table = "\n".join(output[url] for url in sorted(output))
Expand Down

0 comments on commit 44109ab

Please sign in to comment.