Skip to content

Feat: Hosts callback None is part of matching constraint #178

Open
@nitsujri

Description

@nitsujri

Request

If callback_func in hosts(callback=callback_func) returns None, then it continues checking the host_patterns.

This allows callback_func to act as part of the pattern-matching constraint.

Why

  • If there are no matches, automatically returns 404 instead of requiring manual handling inside the callback.
    • Currently, the callback has to manually return a HttpResponse() as None will continue the request.
  • Allows for DB based pattern matching.
    • Complex apps/lots of routes can have stronger sub-grouping.

Possible Alternatives

  • Add a constraint_func to hosts() instead.

Next Steps

I'm happy to work on it, but wanted feedback first since it should be considered a breaking change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions