def save(self, *args, **kwargs): if self.markup == "bbcode": self.body_html = bbmarkup.bbcode(self.body) elif self.markup == "markdown": self.body_html = unicode(Markdown(self.body, safe_mode="escape")) # self.body_html = markdown(self.body, 'safe') else: raise Exception("Invalid markup property: %s" % self.markup) self.body_html = urlize(self.body_html) if forum_settings.SMILES_SUPPORT: self.body_html = smiles(self.body_html) super(PrivateMessage, self).save(*args, **kwargs)
def save(self, *args, **kwargs): if self.markup == 'bbcode': self.body_html = bbmarkup.bbcode(self.body) elif self.markup == 'markdown': self.body_html = unicode(Markdown(self.body, safe_mode='escape')) #self.body_html = markdown(self.body, 'safe') else: raise Exception('Invalid markup property: %s' % self.markup) self.body_html = urlize(self.body_html) if forum_settings.SMILES_SUPPORT: self.body_html = smiles(self.body_html) super(PrivateMessage, self).save(*args, **kwargs)
def post_preview(request): '''Preview for markitup''' markup = request.user.forum_profile.markup data = request.POST.get('data', '') if markup == 'bbcode': data = bbmarkup.bbcode(data) elif markup == 'markdown' and MARKDOWN_AVAILABLE: data = unicode(Markdown(data, safe_mode='escape')) else: raise Exception('Invalid markup property: %s' % markup) data = urlize(data) if forum_settings.SMILES_SUPPORT: data = smiles(data) return {'data': data}