diff options
Diffstat (limited to 'tbc')
-rwxr-xr-x | tbc/views.py | 11 |
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" |