aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNavan Chauhan <navanchauhan@gmail.com>2020-09-11 21:52:05 +0530
committerNavan Chauhan <navanchauhan@gmail.com>2020-09-11 21:52:05 +0530
commit33b19472c694527e13236d35ee4cba7b96756802 (patch)
treee5a2305ce41f556cebb41629de0e80f268f99b97
parentccc014b49279b96ba094fd8b652f9b3e71790c59 (diff)
common error page for job statusv0.9.0
-rw-r--r--app/misc.ini6
-rw-r--r--app/templates/error.html11
-rw-r--r--app/templates/job_status_error.html15
-rw-r--r--app/views.py7
4 files changed, 20 insertions, 19 deletions
diff --git a/app/misc.ini b/app/misc.ini
index e9ce9b6..875fa7d 100644
--- a/app/misc.ini
+++ b/app/misc.ini
@@ -5,4 +5,8 @@ OD02 = Failed to add charges to molecule
OD03 = Failed to write the converted PDBQT file
PL02 = Failed to import PLIP, please ensure that you have correctly installed PLIP
-PL01 = Failed to fetch the PDB, please check the PDB Code \ No newline at end of file
+PL01 = Failed to fetch the PDB, please check the PDB Code
+
+DB01 = This Job ID does not exist 😠. If you think this is an error, please contact us.
+
+CW01 = Looks like an invalid PDB ID \ No newline at end of file
diff --git a/app/templates/error.html b/app/templates/error.html
index 3073037..b605430 100644
--- a/app/templates/error.html
+++ b/app/templates/error.html
@@ -5,7 +5,7 @@
<h2>Oh Snap! An error occured</h2>
<p>Error Code: {{code}}</p>
<p>Error Description: {{description}}</p>
- <section>
+ <!--<section>
<style>
#puzzle{
height: 40vh;
@@ -13,5 +13,14 @@
</style>
<div id="puzzle"></div>
<script src="{{url_for('static',filename='js/missing_puzzle.js')}}"></script>
+ </section>-->
+ <section>
+ <style>
+ #chemical{
+ height: 40vh;
+ }
+ </style>
+ <div id="chemical"></div>
+ <script src="{{url_for('static',filename='js/chemical.js')}}"></script>
</section>
{% endblock %} \ No newline at end of file
diff --git a/app/templates/job_status_error.html b/app/templates/job_status_error.html
deleted file mode 100644
index b6d16a7..0000000
--- a/app/templates/job_status_error.html
+++ /dev/null
@@ -1,15 +0,0 @@
-{% extends 'base.html' %}
-
-{% block main %}
- <h2>Job ID: {{ job }}</h2>
- <p>This Job ID does not exist 😠. If you think this is an error, please contact us.</p>
- <section>
- <style>
- #chemical{
- height: 40vh;
- }
- </style>
- <div id="chemical"></div>
- <script src="{{url_for('static',filename='js/chemical.js')}}"></script>
- </section>
-{% endblock %} \ No newline at end of file
diff --git a/app/views.py b/app/views.py
index ef3c2ba..dfd33e2 100644
--- a/app/views.py
+++ b/app/views.py
@@ -114,7 +114,7 @@ def status():
mycursor.execute(sqlQuery)
records = mycursor.fetchall()
if records == []:
- return render_template('job_status_error.html',job=jobID)
+ return render_template('error.html',code="DB01",description=errors['DB01'])
r = records[0]
protein_name = r[1]
ligand_name = r[2]
@@ -346,6 +346,9 @@ def dock_upload_single():
name = form.name.data
email = form.email.data
+ if len(pdb) != 4:
+ return render_template("error.html",code="CW01",description=errors['CW01'])
+
import mysql.connector as con
mycon = con.connect(host=app.config['DB_HOST'],user=app.config['DB_USER'],password=app.config['DB_PASSWORD'],port=app.config['DB_PORT'],database=app.config['DB_NAME'])
mycursor = mycon.cursor()
@@ -356,7 +359,7 @@ def dock_upload_single():
insert_tuple = (jobID,email,pdb,smile,name,description)
mycursor.execute(sqlQuery,insert_tuple)
mycon.commit()
-
+
log(("Description",description),"DEBUG")
cwd = os.path.join(os.getcwd(),"app")