diff options
Diffstat (limited to 'bn_django')
-rw-r--r-- | bn_django/git_wiki/templates/git_wiki/item.html | 4 | ||||
-rw-r--r-- | bn_django/git_wiki/views.py | 28 | ||||
-rw-r--r-- | bn_django/photos/templates/photos/photo_detail.html | 4 |
3 files changed, 19 insertions, 17 deletions
diff --git a/bn_django/git_wiki/templates/git_wiki/item.html b/bn_django/git_wiki/templates/git_wiki/item.html index e26722d..69332fd 100644 --- a/bn_django/git_wiki/templates/git_wiki/item.html +++ b/bn_django/git_wiki/templates/git_wiki/item.html @@ -36,9 +36,9 @@ They will be lost if the item is updated.</em></p> <h3>Post a comment</h3> {% if user.is_authenticated %} -{% comment_form for git_wiki.item item.id with is_public yes %} +{% comment_form for git_wiki.item item.id with is_public true %} {% else %} -{% free_comment_form for git_wiki.item item.id with is_public yes %} +{% free_comment_form for git_wiki.item item.id with is_public true %} {% endif %} <br /> {% get_comment_list for git_wiki.item item.id as comments %} diff --git a/bn_django/git_wiki/views.py b/bn_django/git_wiki/views.py index 6eff54b..5a4efbd 100644 --- a/bn_django/git_wiki/views.py +++ b/bn_django/git_wiki/views.py @@ -119,19 +119,21 @@ def pdfitem(request, reqslug, blob=None): tmpdir = tempfile.mkdtemp() pre = i.slug().split('/') for fig in re.findall('\\includegraphics.*\{(.+)\}', parts['whole']): - if len(pre) > 1: - fig_blob = fromslug("%s/%s" % ('/'.join(pre[:-1])),fig) - else: - fig_blob = fromslug(fig) - # if might have to create subdirectories for figures - fig_pre = fig.split('/') - if len(fig_pre) > 1: - os.mkdir("%s/%s" % (tmpdir,'/'.join(fig_pre[:-1]))) - fig_file = file(str("%s/%s" % (tmpdir,fig)),'wb') - fig_blob.update() - fig_file.write(fig_blob.contents) - fig_file.close() - + try: + if len(pre) > 1: + fig_blob = fromslug("%s/%s" % ('/'.join(pre[:-1])),fig) + else: + fig_blob = fromslug(fig) + fig_blob.update() + # if might have to create subdirectories for figures + fig_pre = fig.split('/') + if len(fig_pre) > 1: + os.mkdir("%s/%s" % (tmpdir,'/'.join(fig_pre[:-1]))) + fig_file = file(str("%s/%s" % (tmpdir,fig)),'wb') + fig_file.write(fig_blob.contents) + fig_file.close() + except: + parts['whole'].replace(fig,'') hr = HttpResponse(mimetype="application/pdf") #hr = HttpResponse() hr['Content-Disposition'] = 'filename=%s.pdf' % reqslug diff --git a/bn_django/photos/templates/photos/photo_detail.html b/bn_django/photos/templates/photos/photo_detail.html index 9a7c290..a2a28c2 100644 --- a/bn_django/photos/templates/photos/photo_detail.html +++ b/bn_django/photos/templates/photos/photo_detail.html @@ -102,9 +102,9 @@ {% load comments %} <h3>Post a comment</h3> {% if user.is_authenticated %} -{% comment_form for photos.photo object.id with is_public yes %} +{% comment_form for photos.photo object.id with is_public true %} {% else %} -{% free_comment_form for photos.photo object.id with is_public yes %} +{% free_comment_form for photos.photo object.id with is_public true %} {% endif %} <br /> {% get_comment_list for photos.photo object.id as comments %} |