From: a_magical_me Date: Thu, 31 Mar 2011 20:51:19 +0000 (-0700) Subject: Add MarkdownString.__html__(). X-Git-Tag: veekun-promotions/2011041101~6^2~12 X-Git-Url: http://git.veekun.com/zzz-pokedex.git/commitdiff_plain/acb88ee169b9a8f255f2e72cca2cf6dc94fd02e8 Add MarkdownString.__html__(). --- diff --git a/pokedex/db/markdown.py b/pokedex/db/markdown.py index 616830a..09f8067 100644 --- a/pokedex/db/markdown.py +++ b/pokedex/db/markdown.py @@ -31,11 +31,17 @@ class MarkdownString(object): def __unicode__(self): return self.source_text + def __str__(self): + return unicode(self.source_text).encode() + + def __html__(self): + return self.as_html + @property def as_html(self): """Returns the string as HTML4.""" - if self._as_html: + if self._as_html is not None: return self._as_html md = markdown.Markdown( diff --git a/pokedex/util.py b/pokedex/util.py index 5231259..d9aec70 100644 --- a/pokedex/util.py +++ b/pokedex/util.py @@ -145,4 +145,3 @@ except ImportError: pass return result -