Esempio n. 1
0
 def clean_summary(self):
     summary = self.cleaned_data.get('summary', '')
     try:
         lmarkdown(summary)
     except Exception, e:
         raise forms.ValidationError("syntax error in summary element %s" %
                                     repr(e))
Esempio n. 2
0
 def clean_body(self):
     body = self.cleaned_data.get('body', '')
     try:
         lmarkdown(body)
     except Exception, e:
         raise forms.ValidationError("syntax error in body element %s " %
                                     repr(e))
Esempio n. 3
0
def preview(request, template='lpreview/preview.html'):
    text = request.REQUEST['text']
    preview = lmarkdown(text)
    if not template:
        return HttpResponse(preview)
    response = direct_to_template(request, template, {'preview': preview})
    response['X-XSS-Protection'] = '0'
    return response
Esempio n. 4
0
def preview(request, template='lpreview/preview.html'):
    text = request.REQUEST['text']
    preview = lmarkdown(text)
    if not template:
        return HttpResponse(preview)
    response = direct_to_template(request, template, {'preview': preview})
    response['X-XSS-Protection'] = '0'
    return response
Esempio n. 5
0
 def item_description(self, item):
     posts = Post.objects.filter(
         parent=item.story,
         published_at__lte=item.revision_date,
         published_at__gte=item.previous_summary(
         ).revision_date) if item.previous_summary() else []
     return lmarkdown(item.body) + '\n\n\n<br /><br /><br />' + ''.join([
         render_to_string(post.template, {'post': post}) for post in posts
     ])
Esempio n. 6
0
 def clean_summary(self):
     summary = self.cleaned_data.get('summary','')
     try:
         lmarkdown(summary)
     except Exception, e:
         raise forms.ValidationError("syntax error in summary element %s" % repr(e))
Esempio n. 7
0
 def clean_body(self):
     body = self.cleaned_data.get('body','')
     try:
         lmarkdown(body)
     except Exception, e:
         raise forms.ValidationError("syntax error in body element %s " % repr(e))
Esempio n. 8
0
 def item_description(self, item):
     posts = Post.objects.filter(parent=item.story, published_at__lte=item.revision_date, published_at__gte=item.previous_summary().revision_date) if item.previous_summary() else []
     return lmarkdown(item.body) + '\n\n\n<br /><br /><br />' + ''.join([render_to_string(post.template, {'post': post}) for post in posts])