Small formatting improvements to common
This commit is contained in:
parent
5d69fc2aa3
commit
41ac9019c6
1 changed files with 38 additions and 37 deletions
|
@ -2,9 +2,7 @@ import logging
|
|||
import datetime
|
||||
import os
|
||||
|
||||
from functools import wraps
|
||||
|
||||
from flask import make_response, render_template, request, abort, session
|
||||
from flask import make_response, render_template, request, session
|
||||
from flask_login import login_user
|
||||
from flask_principal import identity_changed
|
||||
|
||||
|
@ -26,6 +24,7 @@ logger = logging.getLogger(__name__)
|
|||
|
||||
|
||||
def common_login(db_user, permanent_session=True):
|
||||
""" Performs login of the given user, with optional non-permanence on the session. """
|
||||
if login_user(LoginWrappedDBUser(db_user.uuid, db_user)):
|
||||
logger.debug('Successfully signed in as: %s (%s)' % (db_user.username, db_user.uuid))
|
||||
new_identity = QuayDeferredPermissionUser.for_user(db_user)
|
||||
|
@ -63,10 +62,11 @@ def _list_files(path, extension):
|
|||
return os.path.join(dp, f)[len('static/'):]
|
||||
|
||||
filepath = os.path.join('static/', path)
|
||||
return [join_path(dp, f) for dp, dn, files in os.walk(filepath) for f in files if matches(f)]
|
||||
return [join_path(dp, f) for dp, _, files in os.walk(filepath) for f in files if matches(f)]
|
||||
|
||||
|
||||
def render_page_template(name, route_data=None, **kwargs):
|
||||
""" Renders the page template with the given name as the response and returns its contents. """
|
||||
library_styles = []
|
||||
main_styles = []
|
||||
library_scripts = []
|
||||
|
@ -110,7 +110,7 @@ def render_page_template(name, route_data=None, **kwargs):
|
|||
if not features.BILLING:
|
||||
version_number = 'Quay %s' % __version__
|
||||
|
||||
resp = make_response(render_template(name,
|
||||
contents = render_template(name,
|
||||
route_data=route_data,
|
||||
external_styles=external_styles,
|
||||
external_scripts=external_scripts,
|
||||
|
@ -142,7 +142,8 @@ def render_page_template(name, route_data=None, **kwargs):
|
|||
license_insufficient=license_validator.insufficient,
|
||||
license_expiring=license_validator.expiring_soon,
|
||||
current_year=datetime.datetime.now().year,
|
||||
**kwargs))
|
||||
**kwargs)
|
||||
|
||||
resp = make_response(contents)
|
||||
resp.headers['X-FRAME-OPTIONS'] = 'DENY'
|
||||
return resp
|
||||
|
|
Reference in a new issue