Coverage for airflow.www.utils : 75%
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
|
not AUTHENTICATE or ( not current_user.is_anonymous() and current_user.is_authenticated() ) )
not AUTHENTICATE or (not current_user.is_anonymous() and current_user.is_superuser()) )
not AUTHENTICATE or (not current_user.is_anonymous() and current_user.data_profiling()) )
sql = """\ SELECT TOP {limit} * FROM ( {sql} ) qry """.format(**locals()) sql = """\ SELECT * FROM ( {sql} ) qry WHERE ROWNUM <= {limit} """.format(**locals()) else: SELECT * FROM ( {sql} ) qry LIMIT {limit} """.format(**locals())
''' Decorator to log user actions ''' def wrapper(*args, **kwargs):
user = login.current_user.username else:
models.Log( event=f.__name__, task_instance=None, owner=user, extra=str(request.args.items())))
''' Decorator to make a view compressed ''' def view_func(*args, **kwargs): def zipper(response):
response.direct_passthrough = False
if (response.status_code < 200 or response.status_code >= 300 or 'Content-Encoding' in response.headers): return response gzip_buffer = IO() gzip_file = gzip.GzipFile(mode='wb', fileobj=gzip_buffer) gzip_file.write(response.data) gzip_file.close()
response.data = gzip_buffer.getvalue() response.headers['Content-Encoding'] = 'gzip' response.headers['Vary'] = 'Accept-Encoding' response.headers['Content-Length'] = len(response.data)
return response
''' Used by cache to get a unique key per URL ''' path = request.path args = str(hash(frozenset(request.args.items()))) return (path + args).encode('ascii', 'ignore')
""" Renders an ACE code editor. """ <div id="{el_id}" style="height:100px;">{contents}</div> <textarea id="{el_id}_ace" name="{form_name}" style="display:none;visibility:hidden;"> </textarea> '''.format( el_id=kwargs.get('id', field.id), contents=escape(text_type(field._value())), form_name=field.id, ) |