From 6cdcc4c3b9ad26bba90d8f3e2a93743963a1b7bb Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Mon, 7 Nov 2016 13:31:57 -0500 Subject: [PATCH] fixes --- contrib/frontends/django/nntpchan/nntpchan/frontend/util.py | 2 +- contrib/frontends/django/nntpchan/nntpchan/frontend/views.py | 2 ++ .../django/nntpchan/nntpchan/templates/frontend/postresult.html | 2 +- contrib/frontends/django/nntpchan/nntpchan/views.py | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/contrib/frontends/django/nntpchan/nntpchan/frontend/util.py b/contrib/frontends/django/nntpchan/nntpchan/frontend/util.py index a48fc74..a757540 100644 --- a/contrib/frontends/django/nntpchan/nntpchan/frontend/util.py +++ b/contrib/frontends/django/nntpchan/nntpchan/frontend/util.py @@ -78,4 +78,4 @@ def createPost(newsgroup, ref, form, files): response = nntp.post(msg.as_bytes()) except Exception as e: return None, 'connection to backend failed, {}'.format(e) - return response, None + return msg["Message-ID"], None diff --git a/contrib/frontends/django/nntpchan/nntpchan/frontend/views.py b/contrib/frontends/django/nntpchan/nntpchan/frontend/views.py index 59d5e8c..af803d6 100644 --- a/contrib/frontends/django/nntpchan/nntpchan/frontend/views.py +++ b/contrib/frontends/django/nntpchan/nntpchan/frontend/views.py @@ -44,6 +44,8 @@ class Postable: code = 201 if ctx['error']: code = 200 + else: + ctx['refresh_url'] = reverse('frontend:thread', args=[util.hashid(ctx['msgid'])]) return HttpResponse(content=render(request, 'frontend/postresult.html', ctx), status=code) diff --git a/contrib/frontends/django/nntpchan/nntpchan/templates/frontend/postresult.html b/contrib/frontends/django/nntpchan/nntpchan/templates/frontend/postresult.html index f31efd2..afa316e 100644 --- a/contrib/frontends/django/nntpchan/nntpchan/templates/frontend/postresult.html +++ b/contrib/frontends/django/nntpchan/nntpchan/templates/frontend/postresult.html @@ -9,7 +9,7 @@
 failed to post: {{error}} 
{% else %} {% if msgid %} -
 {{msgid}} 
+
 posted as {{msgid}} 
{% else %}
 message was not posted 
{% endif %} diff --git a/contrib/frontends/django/nntpchan/nntpchan/views.py b/contrib/frontends/django/nntpchan/nntpchan/views.py index 2414981..1093711 100644 --- a/contrib/frontends/django/nntpchan/nntpchan/views.py +++ b/contrib/frontends/django/nntpchan/nntpchan/views.py @@ -96,7 +96,7 @@ def webhook(request): continue filename = part.get_filename() mtype = part.get_content_type() - ext = filename.split('.')[-1] + ext = filename.split('.')[-1].lower() fh = util.hashfile(bytes(payload)) fn = fh + '.' + ext fname = os.path.join(settings.MEDIA_ROOT, fn)