summaryrefslogtreecommitdiff
path: root/tbc
diff options
context:
space:
mode:
authorTrupti Rajesh Kini2016-01-25 12:10:22 +0530
committerTrupti Rajesh Kini2016-01-25 12:10:22 +0530
commit8e701a9e73329d09804fd138098bce7c6e014a81 (patch)
tree7748b03877941f41961a413a0564b681d35837ad /tbc
parentf2c13ce63f8f3be4612091eec786896c60575cf6 (diff)
downloadPython-TBC-Interface-8e701a9e73329d09804fd138098bce7c6e014a81.tar.gz
Python-TBC-Interface-8e701a9e73329d09804fd138098bce7c6e014a81.tar.bz2
Python-TBC-Interface-8e701a9e73329d09804fd138098bce7c6e014a81.zip
HTML files creation timestamp
Updated the function ConvertNotebook with the timestamp for generating html files everytime the notebook files are updated.
Diffstat (limited to 'tbc')
-rwxr-xr-xtbc/views.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/tbc/views.py b/tbc/views.py
index d73ff2f..19c9b3b 100755
--- a/tbc/views.py
+++ b/tbc/views.py
@@ -1199,8 +1199,15 @@ def ConvertNotebook(request, notebook_path=None):
path = "/".join(path)+"/"
os.chdir(path)
try:
- template = path+notebook_name+".html"
- return render_to_response(template, {})
+ changed_time = time.ctime(os.path.getctime(path+notebook_name+".html"))
+ modified_time = time.ctime(os.path.getctime(path+notebook_name+".ipynb"))
+ if(changed_time > modified_time):
+ template = path+notebook_name+".html"
+ return render_to_response(template, {})
+ else:
+ os.popen("ipython nbconvert --to html \""+path+notebook_name+".ipynb\"")
+ template = path+notebook_name+".html"
+ return render_to_response(template, {})
except:
os.popen("ipython nbconvert --to html \""+path+notebook_name+".ipynb\"")
template = path+notebook_name+".html"