def render_page(request, page, current_language, slug):
 template_name = get_template_from_request(request, page, no_current_page=True)
 context = {}
 context['lang'] = current_language
 context['current_page'] = page
 context['has_change_permissions'] = user_can_change_page(request.user, page)
 context['has_view_permissions'] = user_can_view_page(request.user, page)
 if (not context['has_view_permissions']):
  return _handle_no_page(request, slug)
 response = TemplateResponse(request, template_name, context)
 response.add_post_render_callback(set_page_cache)
 xframe_options = page.get_xframe_options()
 if ((xframe_options == Page.X_FRAME_OPTIONS_INHERIT) or (xframe_options is None)):
  return response
 response.xframe_options_exempt = True
 if (xframe_options == Page.X_FRAME_OPTIONS_ALLOW):
  return response
 elif (xframe_options == Page.X_FRAME_OPTIONS_SAMEORIGIN):
  response['X-Frame-Options'] = 'SAMEORIGIN'
 elif (xframe_options == Page.X_FRAME_OPTIONS_DENY):
  response['X-Frame-Options'] = 'DENY'
 return response

def render_page ( request , page , current_language , slug ) : template_name = get_template_from_request ( request , page , no_current_page = True ) context = { } context [ 'lang' ] = current_language context [ 'current_page' ] = page context [ 'has_change_permissions' ] = user_can_change_page ( request . user , page ) context [ 'has_view_permissions' ] = user_can_view_page ( request . user , page ) if ( not context [ 'has_view_permissions' ] ) : return _handle_no_page ( request , slug ) response = TemplateResponse ( request , template_name , context ) response . add_post_render_callback ( set_page_cache ) xframe_options = page . get_xframe_options ( ) if ( ( xframe_options == Page . X_FRAME_OPTIONS_INHERIT ) or ( xframe_options is None ) ) : return response response . xframe_options_exempt = True if ( xframe_options == Page . X_FRAME_OPTIONS_ALLOW ) : return response elif ( xframe_options == Page . X_FRAME_OPTIONS_SAMEORIGIN ) : response [ 'X-Frame-Options' ] = 'SAMEORIGIN' elif ( xframe_options == Page . X_FRAME_OPTIONS_DENY ) : response [ 'X-Frame-Options' ] = 'DENY' return response
renders a page .