Mercurial > hg > bitsyblog
changeset 113:8f30c2f702bc
py3
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Tue, 03 Nov 2020 14:07:56 -0800 |
parents | d1114b31aaf1 |
children | 73434c2db108 |
files | bitsyblog/utils.py |
diffstat | 1 files changed, 3 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/bitsyblog/utils.py Tue Nov 03 14:05:41 2020 -0800 +++ b/bitsyblog/utils.py Tue Nov 03 14:07:56 2020 -0800 @@ -15,6 +15,7 @@ timeformat = ( 'YYYY', 'MM', 'DD', 'HH', 'MM', 'SS' ) timestamp = '%Y%m%d%H%M%S' # strftime representation + def ReST2html(string): """renders a string with restructured text""" @@ -25,11 +26,12 @@ writer_name='html', settings_overrides=settings) body = parts['body'] - except (SystemMessage, UnicodeError), e: + except (SystemMessage, UnicodeError) as e: lines = [ cgi.escape(i.strip()) for i in string.split('\n') ] body = '<br/>\n'.join(lines) return body + def validate_css(css): """use a webservice to determine if the argument is valid css""" url = 'http://jigsaw.w3.org/css-validator/validator?text=%s'