Skip to content

Ability to configure the URL routing engine #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Archmonger opened this issue Oct 14, 2022 · 3 comments · Fixed by #6
Closed

Ability to configure the URL routing engine #5

Archmonger opened this issue Oct 14, 2022 · 3 comments · Fixed by #6
Assignees

Comments

@Archmonger
Copy link
Contributor

Currently is impossible to hijack idom-router internals to utilize something like Django's URL routing schema.

We need some kind of way of configuring this behavior.

For example, within idom-router.conf perhaps there is a global called ROUTING_ENGINE: Callable.

The interface for this callable is up for debate.

@Archmonger
Copy link
Contributor Author

Archmonger commented Oct 19, 2022

Here is Django's URL Resolver.

It has a check() method that determines one URL match out of a list of URLs (django.urls.path or django.urls.re_path) contained in self.url_patterns.

@rmorshea
Copy link
Contributor

rmorshea commented Oct 20, 2022

I drafted up a PR anticipating some upstream changes.

Django would use this RoutePattern class to implement the route compiler interface:

def compile_django_route(path: str) -> idom_router.CompiledPath:
    django_route = RoutePattern(path)
    return CompiledPath(django_route.regex, {k, v.to_python for k, v in django_route.converters.items()})

@Archmonger
Copy link
Contributor Author

Archmonger commented Oct 20, 2022

I will implement that router functionality within django-idom when the idom-router scaffolding is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants