Closed henhuy closed 3 years ago
Django's django.urls.conf.path
uses positional not keyword args, the plan with distill
would be to mirror what Django does internally.
https://github.com/django/django/blob/master/django/urls/conf.py#L57
Your view=
kwarg is actually incorrect and should probably be changed to a positional arg. I'd reconsider this if Django itself made the change. As you've noted, all distill
does is pop off the distill_func=
and optionally distill_file=
kwargs then just passes *args
and **kwargs
back to Django's normal path()
function so distill
itself doesn't interfere with how it should URL definitions should be working.
You are right - my version works for django, but originally it is a simple arg. Most of the time, I use keywords in order to make things clearer at first sight. Sorry for bothering you...
No problem at all, thanks for the contributions.
I stumbled upon keywords in
distill_path
function when switching from defaultdjango.urls.path
todistill_path
. My originalpath
looked something like this:Simply changing it into:
gave me a strange error without stack trace:
But I could figure it out:
distill_path
expects first two arguments given as simple args (not kwargs) - See line: https://github.com/meeb/django-distill/blob/ea6132b6c21c73265c5b80389c9fb448c9eb7297/django_distill/renderer.py#L120 This works:Maybe this could be changed to support keyword args - or at least a better Exception with explanation could be thrown?