From f73640522bdd9d218fb00786b54b683da23a17b5 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Sun, 29 Jan 2023 12:41:50 +0000 Subject: [PATCH] More public debug reports --- core/views/statistics.py | 23 ++++++++++++++--------- templates/controlPanel.html | 3 ++- templates/survexdebug.html | 25 +++++++++++++++++++++++++ templates/survexreport.html | 17 ++++++++--------- urls.py | 1 + 5 files changed, 50 insertions(+), 19 deletions(-) create mode 100644 templates/survexdebug.html diff --git a/core/views/statistics.py b/core/views/statistics.py index 65aca94..34512d8 100644 --- a/core/views/statistics.py +++ b/core/views/statistics.py @@ -48,20 +48,25 @@ def surveximport(request): """Page displaying contents of a file produced during data import""" logname = "svxlinear.log" logpath = (Path(settings.PYTHON_PATH, logname)) - contents = [] - newlog = [] if Path(logpath).is_file: with open(logpath, "r") as f: - contents = f.readlines() - print(f"{logpath} has {len(contents)} entries") + contents = f.read() else: print(f"{logpath} NOT FOUND {len(contents)}") - - for line in contents: - line = line.replace(" ", " ") - newlog.append(line) - return render(request, 'survexreport.html', {"log":newlog}) + return render(request, 'survexreport.html', {"log":contents}) + +def survexdebug(request): + """Page displaying contents of a file produced during data import""" + logname = "svxblks.log" + logpath = (Path(settings.PYTHON_PATH, logname)) + + if Path(logpath).is_file: + with open(logpath, "r") as f: + contents = f.read() + else: + print(f"{logpath} NOT FOUND {len(contents)}") + return render(request, 'survexdebug.html', {"log":contents}) def pathsreport(request): diff --git a/templates/controlPanel.html b/templates/controlPanel.html index 7b5903e..4203821 100644 --- a/templates/controlPanel.html +++ b/templates/controlPanel.html @@ -24,7 +24,8 @@
  • Folder paths used -folders settings used by this troggle installation
  • Expoer name aliases -short names recognised by troggle
  • Data Issues on Imports - warnings and errors from the recent data import -
  • Survex import record - indented *include and begin/end tree
  • Therion Import issues - warnings from the recent data import

    +
  • Survex import record - indented *include and begin/end tree
  • Survex debug report - warnings and details
    +
  • Therion Import issues - warnings from the recent data import

  • Django admin - Deep magic access to all models and data

    This control panel is being redeveloped

    diff --git a/templates/survexdebug.html b/templates/survexdebug.html new file mode 100644 index 0000000..ec78fbd --- /dev/null +++ b/templates/survexdebug.html @@ -0,0 +1,25 @@ +{% extends "base.html" %} +{% block title %}Data import report{% endblock %} + +{% block content %} +

    Expo Survex debug report

    + + +

    Running list of warnings during import

    + +
    +

    See Survex import record - indented *include and begin/end tree
    +

    Go to Control panel - for other import reports
    +


    +
    +

    +{{log}} +

    +

    This report is generated from templates/survexdebug.html and +by survexdebug(request) in core/views/statistics.py +


    +

    Go to Survex import record - indented *include and begin/end tree
    +

    Go to Control panel - for other import reports +

    Go to Troggle maintenance manuals +{% endblock %} + diff --git a/templates/survexreport.html b/templates/survexreport.html index aec0435..535cec4 100644 --- a/templates/survexreport.html +++ b/templates/survexreport.html @@ -10,19 +10,18 @@

    An extra line *edulcni is inserted to show where an included file ends. The *include and *edulcni lines omit the ".svx" from the end of the filename.

    The survex files which are NOT part of the main include tree have been collected together and included under a constructed file "_unseens" following the line "0 *include _unseens" into a begin/end block labelled "troggle_unseens".


    -

    Go to Control panel - for other import reports +Go to Survex debug report - warnings and details
    +Go to Control panel - for other import reports


    +
     

    -{% for line in log %} -{{line|safe}}
    -{% empty %} -No import report file found. Re-import using databaseReset.py -{% endfor %} - +{{log}} +

    This report is generated from templates/survexreport.html and by survexreport(request) in core/views/statistics.py


    -

    Go to Control panel - for other import reports -

    Go to Troggle maintenance manuals +Go to Survex debug report - warnings and details
    +Go to Control panel - for other import reports +Go to Troggle maintenance manuals {% endblock %} diff --git a/urls.py b/urls.py index f7fcc3b..744928b 100644 --- a/urls.py +++ b/urls.py @@ -149,6 +149,7 @@ trogglepatterns = [ path('dataissues', statistics.dataissues, name="dataissues"), path('therionissues', statistics.therionissues, name="therionissues"), path('surveximport', statistics.surveximport, name="surveximport"), + path('survexdebug', statistics.survexdebug, name="survexdebug"), path('eastings', statistics.eastings, name="eastings"), path('aliases/',statistics.aliases, name="aliases"),