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})
def status_logs(request):
def status_log(request):
"""Serve the last 100 lines of plinth's status log"""
num_lines = 100
logfile = open(cfg.status_log_file, 'r')
data = logfile.readlines()
with open(cfg.status_log_file, 'r') as log_file:
data = log_file.readlines()
data = ''.join(data[-num_lines:])
context = {
'num_lines': num_lines,
'data': data
}
logfile.close()
return TemplateResponse(request, 'statuslog.html', context)

View File

@ -1,46 +1,49 @@
{% extends 'help_base.html' %}
{% comment %}
#
# This file is part of Plinth.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# 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/>.
#
#
# This file is part of Plinth.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# 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/>.
#
{% endcomment %}
{% load i18n %}
{% block content %}
<p>
{% 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>
<h2>{% trans "Status Log" %}</h2>
<p>
<b>
{% blocktrans trimmed %}
Caution: Please remove any passwords or other personal information from the
log, before submitting the bug report.
{% endblocktrans %}
</b>
</p>
<p>
{% blocktrans trimmed %}
These are 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">bug tracker</a> and
attach this status log to the bug report.
{% endblocktrans %}
</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 %}

View File

@ -32,5 +32,5 @@ urlpatterns = [
url(r'^help/index/$', views.index, name='index_explicit'),
url(r'^help/about/$', views.about, name='about'),
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>
<p>
{% url 'help:status-log' as status_log_url %}
{% blocktrans trimmed %}
This is an internal error and not something you caused or can
fix. Please report the error on
the <a href="https://github.com/freedombox/Plinth/issues">bug
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 %}
</p>