Commit a9a134d0 authored by Alain Takoudjou's avatar Alain Takoudjou

remove useless functions

parent 90a3652b
...@@ -252,27 +252,3 @@ def unwrap(wrapped, getCertificate, digest_list): ...@@ -252,27 +252,3 @@ def unwrap(wrapped, getCertificate, digest_list):
raise BadSignature('Signature mismatch: %s' % str(e)) raise BadSignature('Signature mismatch: %s' % str(e))
return payload return payload
def tail(path, lines=100):
"""
Returns the last `lines` lines of file `path`.
"""
f = open(path).read()
BUFSIZ = 1024
f.seek(0, 2)
bytes = f.tell()
size = lines + 1
block = -1
data = []
while size > 0 and bytes > 0:
if bytes - BUFSIZ > 0:
f.seek(block * BUFSIZ, 2)
data.insert(0, f.read(BUFSIZ))
else:
f.seek(0, 0)
data.insert(0, f.read(bytes))
linesFound = data[0].count('\n')
size -= linesFound
bytes -= BUFSIZ
block -= 1
return '\n'.join(''.join(data).splitlines()[-lines:])
...@@ -676,17 +676,3 @@ def user_profile(): ...@@ -676,17 +676,3 @@ def user_profile():
return render_template('user_profile.html', return render_template('user_profile.html',
form=form) form=form)
@app.route('/admin/logs', methods=['GET'])
@login_required
def view_logs():
content = ""
full_log = request.args.get('full', '')
if app.config.log_file and os.path.exists(app.config.log_file):
if full_log == 'true':
with open(app.config.log_file) as f:
content = f.read()
else:
content = utils.tail(app.config.log_file, 500)
return render_template("view_logs.html", content=content, filename=app.config.log_file)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment