--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/6d39c5c0-bd79-48ec-8ae4-bad4ae023237n%40googlegroups.com.
In both cases however, the current check being done in the process_response method for the CommonMiddleware(here) seems irrelevant to me unless I am missing something.
That said, I think doing this in process_response would be preferable over doing it in process_request so the extra checks when the URL is valid (the common case) are reduced. Resolving URLs can take a bit, especially when the urlconf is long and as such I'd like to get that check out of the "hot" code path. Only doing the redirect in the case of a failing resolve in the first place would probably make this more efficient.
--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/41821059-b9a5-433b-b08d-78e3d99d84dcn%40googlegroups.com.
I took a quick glance (literally just that) at the pull requests. I do like the one that offers a way to abort early inside a prefix -- this is a nice optimization and as well might open interesting options for specialized catch all views. I am not convinced about the backtracking PR, which problems does this solve in reality? What does this mean for features like atomic requests -- it is still just one request after all…
That said, I think doing this in process_response would be preferable over doing it in process_request so the extra checks when the URL is valid (the common case) are reduced. Resolving URLs can take a bit, especially when the urlconf is long and as such I'd like to get that check out of the "hot" code path. Only doing the redirect in the case of a failing resolve in the first place would probably make this more efficient.I agree. I guess it might need a deprecation cycle to move it to process_response though?
With the suggested work-around of having a view call other views, would a view be able to continue URL resolution in that case?
To avoid the problems with the bad interaction with the request machinery, another approach that came to mind would be to allow inserting / including a function at any point in the URLconf. The function would return whether the pattern should be skipped or claimed. That would have the advantage of taking place before any view is started.
To avoid the problems with the bad interaction with the request machinery, another approach that came to mind would be to allow inserting / including a function at any point in the URLconf. The function would return whether the pattern should be skipped or claimed. That would have the advantage of taking place before any view is started.
--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/0c72e667-0223-4a28-8e4f-83c5d0f3c758n%40googlegroups.com.