reviewboard.accounts.decorators¶
- check_login_required(view_func)[source]¶
Check whether the user needs to log in.
This is a view decorator that checks whether login is required on this installation and, if so, checks if the user is logged in. If login is required and the user is not logged in, they’re redirected to the login link.
- valid_prefs_required(view_func=None, disable_consent_checks=None)[source]¶
Check whether the profile object exists.
Several views assume that the user profile object exists, and will break if it doesn’t. This decorator will ensure that the profile exists before the view code runs.
If the user is not logged in, this will do nothing. That allows it to be used with @check_login_required.
- Parameters:
view_func (
callable
, optional) –The view to decorate.
If this is not specified, this function returns a decorator that accepts a view to decorate.
disable_consent_checks (
callable
, optional) – A callable that will determine whether or not consent checks should be disabled.
- Returns:
If
view_func
was provided, this returns a decorated version of that view. Otherwise a decorator is returned.- Return type:
callable