diff options
author | Christopher Allan Webber <cwebber@dustycloud.org> | 2011-06-20 21:01:05 -0500 |
---|---|---|
committer | Christopher Allan Webber <cwebber@dustycloud.org> | 2011-06-20 21:01:05 -0500 |
commit | 826888465397ef8915b3a4a538ad26dff08d2625 (patch) | |
tree | 6a086495c6cc80defe145f9531d9ccab1e29aa57 | |
parent | 5c441e75ebc4ad63c3a5362d9bc451abe97984d2 (diff) | |
download | mediagoblin-826888465397ef8915b3a4a538ad26dff08d2625.tar.lz mediagoblin-826888465397ef8915b3a4a538ad26dff08d2625.tar.xz mediagoblin-826888465397ef8915b3a4a538ad26dff08d2625.zip |
Fix cleaned_markdown_conversion so that it doesn't bork on empty strings
Basically, clean_html would throw an error on '', so we just return ''
"if not text"
-rw-r--r-- | mediagoblin/util.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/mediagoblin/util.py b/mediagoblin/util.py index 0e43a1f5..e964324f 100644 --- a/mediagoblin/util.py +++ b/mediagoblin/util.py @@ -383,6 +383,11 @@ def cleaned_markdown_conversion(text): """ Take a block of text, run it through MarkDown, and clean its HTML. """ + # Markdown will do nothing with and clean_html can do nothing with + # an empty string :) + if not text: + return u'' + return clean_html(MARKDOWN_INSTANCE.convert(text)) |