I think that patch was just an example of bad abstraction. For instance, _log_and_response was strange and confusingly named, and seemed to be there mostly for vanity, to mask the imperative nature of the top level of control.
When "properly" abstracted, class-based views, IMHO, are much simpler to reason about. And, despite the one extra indentation level of a method (vs a module "function"), CBV tend to offer flatter logic and better separation of concerns.
Somewhat ironically, I find better examples of functional style code in CBV than I do in view functions.
--
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-developers+unsubscribe@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/6acd4821-d51f-4bf4-9550-f3843eb28805%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
When reviewing the patch for the auth class-based view additions, I made the mistake of assuming that the existing tests would catch this type of obviously incorrect issue. Perhaps with the function-based views, the code was "too obviously correct" that a test for token verification on POST wasn't considered. I'd like to think that future work on the class-based views would be more careful about testing, especially after we made this mistake.
--
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 post to this group, send email to django-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/19b675f5-c25a-43e8-ac73-2a31b9e351d6%40googlegroups.com.
… that the existing tests would catch this type of obviously incorrect issue.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/32ca3ed6-abbe-1268-bd12-9cce3c314d9f%40gmail.com.
--
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-developers+unsubscribe@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/9a031420-c8e9-407f-a32c-8a14e47a0d98%40googlegroups.com.
Hi,
On Monday, November 21, 2016 at 11:56:56 PM UTC+1, Tim Graham wrote:… that the existing tests would catch this type of obviously incorrect issue.
I think that is the main issue here. I was also really surprised to discover that the tests were missing cases like this -- then again, writing good tests is hard and I know that I am personally one not to write good tests usually. Either way, I think the way forward is to improve the testsuite in this case.
2. Make some guesses about well known edge cases and test them
(e.g the empty string case etc.). However this could be a complete
waste of time
3. Look at the implementation at work out where it might go
wrong. This one is really important in reality.
And this is what the existing tests did. Out of the infinite number of HTTP requests to test under point 1, they happened to pick a GET request, which was perfectly sensible. In the case of FBVs, the control flow is so clear that all of the following are equally silly tests to add:
1. Recognise that CBVs are much harder to reason about, and therefore require much more care.
2. Avoid using CBVs unless you really need them.