From 6fb17e23b11e5ed79a593c0dd4026606c3d84d42 Mon Sep 17 00:00:00 2001 From: hardythe1 Date: Wed, 30 Apr 2014 15:03:38 +0530 Subject: changes to escape special characters in file name --- tbc/models.py | 2 ++ tbc/views.py | 4 +--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tbc/models.py b/tbc/models.py index 4465a4d..76c9dc6 100644 --- a/tbc/models.py +++ b/tbc/models.py @@ -38,6 +38,8 @@ ABOUT_PROJ = (("pythontbc website", "Python TBC Website"), ("posters in college", "Through Posters in College"), ("others", "Others")) + + def get_notebook_dir(instance, filename): return '%s/%s/%s' % (instance.book.contributor, instance.book.title.replace(' ', '_'), filename.replace(' ', '_')) diff --git a/tbc/views.py b/tbc/views.py index fd8fed3..0c75f96 100755 --- a/tbc/views.py +++ b/tbc/views.py @@ -605,11 +605,9 @@ def ConvertNotebook(request, notebook_path=None): try: template = path.split("/")[8:] template = "/".join(template)+notebook_name+".html" - print ("try") return render_to_response(template, {}) except: - os.popen("ipython nbconvert --to html "+path+notebook_name+".ipynb") + os.popen("ipython nbconvert --to html \""+path+notebook_name+".ipynb\"") template = path.split("/")[8:] template = "/".join(template)+notebook_name+".html" - print ("except") return render_to_response(template, {}) -- cgit