help: Minor updates and fixes to status log

- Refactor reading status log file.

- Fix hardcoded URL path into 500.html.

- Rename 'status logs' to 'status log' for consistency.

- Decorate the personal information warning.  Avoid <b>.

- Add heading to status log page.

- Indentation and grammer fixes.
This commit is contained in:
Sunil Mohan Adapa 2016-08-22 18:11:22 +05:30 committed by James Valleroy
parent ddc7e07ea1
commit 037944e5fc
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
4 changed files with 45 additions and 41 deletions

View File

@ -73,15 +73,15 @@ def manual(request):
'content': content}) 'content': content})
def status_logs(request): def status_log(request):
"""Serve the last 100 lines of plinth's status log""" """Serve the last 100 lines of plinth's status log"""
num_lines = 100 num_lines = 100
logfile = open(cfg.status_log_file, 'r') with open(cfg.status_log_file, 'r') as log_file:
data = logfile.readlines() data = log_file.readlines()
data = ''.join(data[-num_lines:]) data = ''.join(data[-num_lines:])
context = { context = {
'num_lines': num_lines, 'num_lines': num_lines,
'data': data 'data': data
} }
logfile.close()
return TemplateResponse(request, 'statuslog.html', context) return TemplateResponse(request, 'statuslog.html', context)

View File

@ -1,46 +1,49 @@
{% extends 'help_base.html' %} {% extends 'help_base.html' %}
{% comment %} {% comment %}
# #
# This file is part of Plinth. # This file is part of Plinth.
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version. # License, or (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details. # GNU Affero General Public License for more details.
# #
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not,see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
{% endcomment %} {% endcomment %}
{% load i18n %} {% load i18n %}
{% block content %} {% block content %}
<p> <h2>{% trans "Status Log" %}</h2>
{% blocktrans trimmed %}
This is the last {{ num_lines }} lines of the status log for this web
interface. If you want to report a bug, please use the
<a href="https://github.com/freedombox/Plinth/issues">bugtracker</a> and
attach this status log to the bug report.
{% endblocktrans %}
</p>
<p> <p>
<b> {% blocktrans trimmed %}
{% blocktrans trimmed %} These are the last {{ num_lines }} lines of the status log for
Caution: Please remove any passwords or other personal information from the this web interface. If you want to report a bug, please use the
log, before submitting the bug report. <a href="https://github.com/freedombox/Plinth/issues">bug tracker</a> and
{% endblocktrans %} attach this status log to the bug report.
</b> {% endblocktrans %}
</p> </p>
<p class="alert alert-warning">
<span class="glyphicon glyphicon-warning-sign" aria-hidden="true"></span>
<span class="sr-only">{% trans "Caution:" %}</span>
{% blocktrans trimmed %}
Please remove any passwords or other personal information from
the log before submitting the bug report.
{% endblocktrans %}
</p>
<p>
<pre>{{ data }}</pre>
</p>
<p>
<pre>{{ data }}</pre>
</p>
{% endblock %} {% endblock %}

View File

@ -32,5 +32,5 @@ urlpatterns = [
url(r'^help/index/$', views.index, name='index_explicit'), url(r'^help/index/$', views.index, name='index_explicit'),
url(r'^help/about/$', views.about, name='about'), url(r'^help/about/$', views.about, name='about'),
url(r'^help/manual/$', views.manual, name='manual'), url(r'^help/manual/$', views.manual, name='manual'),
url(r'^help/status-logs/$', views.status_logs, name='status-logs'), url(r'^help/status-log/$', views.status_log, name='status-log'),
] ]

View File

@ -25,12 +25,13 @@
<h2>{% trans "500" %}</h2> <h2>{% trans "500" %}</h2>
<p> <p>
{% url 'help:status-log' as status_log_url %}
{% blocktrans trimmed %} {% blocktrans trimmed %}
This is an internal error and not something you caused or can This is an internal error and not something you caused or can
fix. Please report the error on fix. Please report the error on
the <a href="https://github.com/freedombox/Plinth/issues">bug the <a href="https://github.com/freedombox/Plinth/issues">bug
tracker</a> so we can fix it. Also, please attach the tracker</a> so we can fix it. Also, please attach the
<a href="/plinth/help/status-logs">Status Log</a> to the bug report. <a href="{{ status_log_url }}">status log</a> to the bug report.
{% endblocktrans %} {% endblocktrans %}
</p> </p>