Major refactor

Re-work upload and file processing so they are in the same Python
function. Now I will start exposing other command line options in
the form, like unsafe fixes, excluding fields, etc. Now I see tha
t it is easier to save the POSTed file and process it in the same
function so I don't have to pass around the other POSTed form val
ues as URL query parameters.

Now, as a result of changing the flow above, I also had to make a
change to the way I show the results page. Instead of processing
the file and returning the rendered results to the user directly,
I process the file, save the rendered results to /tmp, and return
a redirect to the user to the results page.
This commit is contained in:
2021-03-13 22:11:26 +02:00
parent adc2d06094
commit 198acdb1a7
3 changed files with 65 additions and 42 deletions

View File

@ -4,19 +4,17 @@
<body class="d-flex flex-column h-100">
{% include 'header.html' %}
<main class="flex-shrink-0">
<div class="container">
<h1 class="mt-3 fs-2">Results</h1>
<p>Processing <code>{{ filename }}</code>. Download <a href="/result/{{ base64name }}/download" title="{{ filename | replace('.csv', '-cleaned.csv') }}">cleaned file</a>.</p>
</div>
</main>
<div class="row justify-content-center">
<div class="col-md-10">
<div class="container py-3">
<p class="lead">The DSpace CSV Metadata Quality Checker is a collection of sanity checks and automated fixes for a number of common issues in metadata files.</p>
<h3>Results</h3>
<p>Results for <code>{{ filename }}</code>. Download <a href="/result/{{ base64name }}/download" title="{{ filename | replace('.csv', '-cleaned.csv') }}">cleaned file</a>.</p>
<h3>Log</h3>
<p>The detailed log of the analysis is below. <span style="color: #00aa00">Green</span> indicates a fix was applied, <span style="color: #aa0000">red</span> indicates an error, and <span style="color: #aa5500">orange</span> indicates a warning.</p>
<blockquote>
{{ stdout | safe }}
{{- stdout | safe -}}
</blockquote>
</div>
</div>
</main>
{% include 'footer.html' %}
</body>