From 15a336613b6ed54aac6732e6f6d206209f9a8af6 Mon Sep 17 00:00:00 2001 From: Hemanth Kumar Veeranki Date: Thu, 21 Jul 2016 13:56:06 +0530 Subject: [PATCH] Fixed PEP8 standards and other specified changes --- plinth/modules/help/help.py | 15 +++++++++------ plinth/modules/help/templates/statuslog.html | 3 ++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/plinth/modules/help/help.py b/plinth/modules/help/help.py index 16433bc1c..24fbf6965 100644 --- a/plinth/modules/help/help.py +++ b/plinth/modules/help/help.py @@ -72,13 +72,16 @@ def manual(request): {'title': _('{box_name} Manual').format(box_name=_(cfg.box_name)), 'content': content}) + def status_logs(request): - X = 100 - file = open(cfg.status_log_file,"r") - data = file.readlines() - data = "".join(data[-X:]) + """ Serves the last 100 lines of Status log""" + nr_lines = 100 + logfile = open(cfg.status_log_file, "r") + data = logfile.readlines() + data = "".join(data[-nr_lines:]) context = { - "X":X, - "data":data + "nr_lines": nr_lines, + "data": data } + logfile.close() return TemplateResponse(request, "statuslog.html", context) diff --git a/plinth/modules/help/templates/statuslog.html b/plinth/modules/help/templates/statuslog.html index abc2b68ae..2efc62ff5 100644 --- a/plinth/modules/help/templates/statuslog.html +++ b/plinth/modules/help/templates/statuslog.html @@ -25,7 +25,8 @@

{% blocktrans trimmed %} - This is the last {{ X }} lines of status log Please attatch with the bug when raising a bug. + This is the last {{ nr_lines }} lines of status log. + If you want to report a bug use bugtracker and attach this status log with that.

{{ data }}
{% endblocktrans %}