# HG changeset patch # User Jeff Hammel # Date 1604441276 28800 # Node ID 8f30c2f702bc1873b3de301b7812b48bf0a02fd8 # Parent d1114b31aaf1b22a6eacc345e2b85aa19e5122f4 py3 diff -r d1114b31aaf1 -r 8f30c2f702bc bitsyblog/utils.py --- 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 = '
\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'