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))
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))
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
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
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 ])
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))
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))
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])