Refs #20456 -- Moved initialization of HEAD method based on GET to the View.setup() for generic views.

This will ease unit testing of views since setup will essentially do
everything needed to set the view instance up (other than instantiating
it). Credit for idea goes to Vincent Prouillet.
This commit is contained in:
Felipe Lee 2019-10-10 00:22:43 -05:00 committed by Mariusz Felisiak
parent 31d1822532
commit c2c27867ef
4 changed files with 12 additions and 7 deletions

View file

@ -79,12 +79,9 @@ MRO is an acronym for Method Resolution Order.
.. method:: setup(request, *args, **kwargs)
Initializes view instance attributes: ``self.request``, ``self.args``,
and ``self.kwargs`` prior to :meth:`dispatch`.
Performs key view initialization prior to :meth:`dispatch`.
Overriding this method allows mixins to setup instance attributes for
reuse in child classes. When overriding this method, you must call
``super()``.
If overriding this method, you must call ``super()``.
.. method:: dispatch(request, *args, **kwargs)