Archived
1
0
This commit is contained in:
Jeff Becker 2016-11-07 13:31:57 -05:00
parent 487495f9ac
commit 6cdcc4c3b9
No known key found for this signature in database
GPG Key ID: AB950234D6EA286B
4 changed files with 5 additions and 3 deletions

View File

@ -78,4 +78,4 @@ def createPost(newsgroup, ref, form, files):
response = nntp.post(msg.as_bytes()) response = nntp.post(msg.as_bytes())
except Exception as e: except Exception as e:
return None, 'connection to backend failed, {}'.format(e) return None, 'connection to backend failed, {}'.format(e)
return response, None return msg["Message-ID"], None

View File

@ -44,6 +44,8 @@ class Postable:
code = 201 code = 201
if ctx['error']: if ctx['error']:
code = 200 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) return HttpResponse(content=render(request, 'frontend/postresult.html', ctx), status=code)

View File

@ -9,7 +9,7 @@
<pre class="error"> failed to post: {{error}} </pre> <pre class="error"> failed to post: {{error}} </pre>
{% else %} {% else %}
{% if msgid %} {% if msgid %}
<pre class="posted"> {{msgid}} </pre> <pre class="posted"> posted as {{msgid}} </pre>
{% else %} {% else %}
<pre class="posted"> message was not posted </pre> <pre class="posted"> message was not posted </pre>
{% endif %} {% endif %}

View File

@ -96,7 +96,7 @@ def webhook(request):
continue continue
filename = part.get_filename() filename = part.get_filename()
mtype = part.get_content_type() mtype = part.get_content_type()
ext = filename.split('.')[-1] ext = filename.split('.')[-1].lower()
fh = util.hashfile(bytes(payload)) fh = util.hashfile(bytes(payload))
fn = fh + '.' + ext fn = fh + '.' + ext
fname = os.path.join(settings.MEDIA_ROOT, fn) fname = os.path.join(settings.MEDIA_ROOT, fn)