As mentioned in #140 (review), odds are that we have a problem with the implementation of environment.get_url().
- The
to argument should correspond to the first positional parameter of the Django shortcut's resolve_url function. Our implementation may break when to is something else than a string.
- Specifically, when
get_absolute_url() returns a URL containing a protocol and a hostname or IP address then there will be two base_urls in the resulting URL string.
Pylint (correctly) complains about to being a keyword-argument used as a positional argument, and to being a bad name. In Django's resolve_url implementation, to is a positional argument, but we want it to be optional (not necessarily a keyword-argument, strictly speaking), e.g.
# returns the value of `base_url`
context.get_url()
# returns base_url + '/admin'
context.get_url('/admin')
When to Is a Model or a View Name
The problem may occur when the argument passed to get_url is not a simple URL path string.
In this case, Django's resolve_url shortcut might return a URL string that has a URL protocol and hostname already included!
Other Issues
Also, it's unclear whether **kwargs also pass the to keyword argument to resolve_url in our implementation, or just the remainder.
What to Do
As mentioned in #140 (review), odds are that we have a problem with the implementation of environment.get_url().
toargument should correspond to the first positional parameter of the Django shortcut'sresolve_urlfunction. Our implementation may break whentois something else than a string.get_absolute_url()returns a URL containing a protocol and a hostname or IP address then there will be two base_urls in the resulting URL string.Pylint (correctly) complains about
tobeing a keyword-argument used as a positional argument, andtobeing a bad name. In Django's resolve_url implementation,tois a positional argument, but we want it to be optional (not necessarily a keyword-argument, strictly speaking), e.g.When
toIs a Model or a View NameThe problem may occur when the argument passed to
get_urlis not a simple URL path string.In this case, Django's
resolve_urlshortcut might return a URL string that has a URL protocol and hostname already included!Other Issues
Also, it's unclear whether
**kwargsalso pass thetokeyword argument toresolve_urlin our implementation, or just the remainder.What to Do
tois not included in**kwargs.environment.get_url().