Commit 739f0e5c authored by Floreal Cabanettes's avatar Floreal Cabanettes
Browse files

Fix filename

parent 986ca4be
......@@ -142,13 +142,14 @@ class Functions:
return j1.email
@staticmethod
def send_fasta_ready(mailer, job_name, sample_name, compressed=False, path="fasta-query", status="success"):
def send_fasta_ready(mailer, job_name, sample_name, compressed=False, path="fasta-query", status="success",
ext="fasta"):
web_url = Functions.config.web_url
with open(os.path.join(os.path.dirname(os.path.realpath(__file__)), "mail_templates", "dl_fasta.html")) \
as t_file:
template = Template(t_file.read())
message_html = template.render(job_name=job_name, status=status, url_base=web_url,
sample_name=sample_name, compressed=compressed, path=path)
sample_name=sample_name, compressed=compressed, path=path, ext=ext)
message = "D-Genies\n\n" \
"Job %s - Download fasta\n\n" % job_name
message += "Query fasta file for job %s (query: %s) is ready to download.\n" % (job_name, sample_name)
......
......@@ -29,7 +29,7 @@
<p>Hi,</p>
{% if status == "success" %}
<p>Query fasta file for job {{ job_name }} (query: {{ sample_name }}) is ready to download.<br/>
You can <a href="{{ url_base }}/{{ path }}/{{ job_name }}/{{ sample_name }}.fasta{% if compressed %}.gz{% endif %}">click here</a> to download it.</p>
You can <a href="{{ url_base }}/{{ path }}/{{ job_name }}/{{ sample_name }}.{{ ext }}{% if compressed %}.gz{% endif %}">click here</a> to download it.</p>
{% else %}
<p>Build of query fasta file for job {{ job_name }} has failed. You can try again. If the problem persists, please contact the support.</p>
{% endif %}
......
......@@ -716,10 +716,13 @@ class Paf:
except Exception:
o_fasta = None
status="fail"
query_fasta = "_._"
parts = os.path.basename(query_fasta).rsplit(".", 1)
Functions.send_fasta_ready(mailer=self.mailer,
job_name=self.id_job,
sample_name="as_reference_" + os.path.basename(query_fasta).rsplit(".", 1)[0],
sample_name="as_reference_" + parts[0],
ext=parts[1],
compressed=False,
path="download",
status=status)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment