From bc0b4acb84c22f93a06cb64a93fbb6d9db43ae28 Mon Sep 17 00:00:00 2001 From: a_magical_me Date: Thu, 31 Mar 2011 13:51:19 -0700 Subject: [PATCH] Add MarkdownString.__html__(). --- pokedex/db/markdown.py | 8 +++++++- pokedex/util.py | 1 - 2 files changed, 7 insertions(+), 2 deletions(-) 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 -