##// END OF EJS Templates
Download image in chunks and limit size even if the server has no...
Download image in chunks and limit size even if the server has no content-lenght or lies

File last commit:

r872:752c0b44 default
r965:b4b69de3 default
Show More
preview.py
37 lines | 952 B | text/x-python | PythonLexer
neko259
Added post preview page
r825 from django.shortcuts import render
from django.template import RequestContext
from django.views.generic import View
from boards.mdx_neboard import bbcode_extended
FORM_QUERY = 'query'
CONTEXT_RESULT = 'result'
CONTEXT_QUERY = 'query'
__author__ = 'neko259'
TEMPLATE = 'boards/preview.html'
class PostPreviewView(View):
def get(self, request):
context = RequestContext(request)
neko259
Updates to support django 1.7
r872 # TODO Use dict here
return render(request, TEMPLATE, context_instance=context)
neko259
Added post preview page
r825
def post(self, request):
context = RequestContext(request)
if FORM_QUERY in request.POST:
raw_text = request.POST[FORM_QUERY]
if len(raw_text) >= 0:
rendered_text = bbcode_extended(raw_text)
context[CONTEXT_RESULT] = rendered_text
context[CONTEXT_QUERY] = raw_text
neko259
Updates to support django 1.7
r872 # TODO Use dict here
return render(request, TEMPLATE, context_instance=context)