@hooks.register(u'before_serve_page')
def check_view_restrictions(page, request, serve_args, serve_kwargs):
 for restriction in page.get_view_restrictions():
  if (not restriction.accept_request(request)):
   if (restriction.restriction_type == PageViewRestriction.PASSWORD):
    from wagtail.wagtailcore.forms import PasswordPageViewRestrictionForm
    form = PasswordPageViewRestrictionForm(instance=restriction, initial={u'return_url': request.get_full_path()})
    action_url = reverse(u'wagtailcore_authenticate_with_password', args=[restriction.id, page.id])
    return page.serve_password_required_response(request, form, action_url)
   elif (restriction.restriction_type in [PageViewRestriction.LOGIN, PageViewRestriction.GROUPS]):
    return require_wagtail_login(next=request.get_full_path())

@ hooks . register ( u'before_serve_page' ) def check_view_restrictions ( page , request , serve_args , serve_kwargs ) : for restriction in page . get_view_restrictions ( ) : if ( not restriction . accept_request ( request ) ) : if ( restriction . restriction_type == PageViewRestriction . PASSWORD ) : from wagtail . wagtailcore . forms import PasswordPageViewRestrictionForm form = PasswordPageViewRestrictionForm ( instance = restriction , initial = { u'return_url' : request . get_full_path ( ) } ) action_url = reverse ( u'wagtailcore_authenticate_with_password' , args = [ restriction . id , page . id ] ) return page . serve_password_required_response ( request , form , action_url ) elif ( restriction . restriction_type in [ PageViewRestriction . LOGIN , PageViewRestriction . GROUPS ] ) : return require_wagtail_login ( next = request . get_full_path ( ) )
check whether there are any view restrictions on this page which are not fulfilled by the given request object .