From 28fe486b327d0e40d86e01a360feb38ff14fdc28 Mon Sep 17 00:00:00 2001 From: bnewbold Date: Wed, 21 Mar 2007 22:02:41 -0700 Subject: comments are public and pdf creation doesn't choke as bad --- bn_django/git_wiki/templates/git_wiki/item.html | 4 ++-- bn_django/git_wiki/views.py | 28 ++++++++++++---------- .../photos/templates/photos/photo_detail.html | 4 ++-- 3 files changed, 19 insertions(+), 17 deletions(-) (limited to 'bn_django') 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.

Post a comment

{% 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 %}
{% 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 %}

Post a comment

{% 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 %}
{% get_comment_list for photos.photo object.id as comments %} -- cgit v1.2.3