Coverage for /home/tribaal/workspace/django-shop/shop/util/login_mixin : 75.61%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
""" A mixin class that provides view securing functionality to class based views similar to the @login_required() decorator. """
""" Mixin for securing a class.
Taken from here: https://groups.google.com/d/msg/django-users/g2E_6ZYN_R0/tnB9b262lcAJ """
"""Logs the user out if necessary.""" logout(request) return HttpResponseRedirect(self.get_login_url())
""" Returns the function that is being used to test if a user is authenticated. """
"""Returns the login URL."""
"""Returns the redirect_field_name."""
test_kwargs['login_url'] = login_url test_kwargs['redirect_field_name'] = redirect_field_name self.get_test_func(), **test_kwargs)(super(LoginMixin, self).dispatch)( request, *args, **kwargs)
""" Returns the test function to be used for authentication and takes the setting `SHOP_FORCE_LOGIN` into consideration.
:param test_func: Optional. You can provide your own test function for authentication. This should be a lambda expression. """ return test_func else: return lambda u: True |