Add MarkdownString.__html__().
authora_magical_me <andrew@turnipmints.mooo.com>
Thu, 31 Mar 2011 20:51:19 +0000 (13:51 -0700)
committera_magical_me <andrew@turnipmints.mooo.com>
Sun, 3 Apr 2011 10:17:04 +0000 (03:17 -0700)
pokedex/db/markdown.py
pokedex/util.py

index 616830a..09f8067 100644 (file)
@@ -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(
index 5231259..d9aec70 100644 (file)
@@ -145,4 +145,3 @@ except ImportError:
             pass
 
         return result
-