Created
November 1, 2014 13:12
-
-
Save tusbar/18ae69c38066fd4cfb02 to your computer and use it in GitHub Desktop.
Mako test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from mako.template import Template | |
with file('template.html') as foo: | |
print Template( | |
foo.read(), | |
output_encoding='utf-8', | |
input_encoding='utf-8', | |
default_filters=['decode.utf8', 'h'], | |
encoding_errors='replace' | |
).render() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%! from markupsafe import escape %> | |
<p>${('The page that you were looking for was not found.')} | |
${escape('Go back to the {link_start}home page{link_end} or let us know about any pages that may have been moved at {email}.').format( | |
link_start='<a href="/">', | |
link_end='</a>', | |
email=u'<a href="mailto:{address}">{address}</a>'.format( | |
address='google.com' | |
)) | n} | |
</p> |
Author
tusbar
commented
Nov 1, 2014
edxapp@precise64:~/mako-tests$ python --version
Python 2.7.3
edxapp@precise64:~/mako-tests$ pip freeze | grep Mako
Mako==0.9.1
edxapp@precise64:~/mako-tests$ uname
Linux
edxapp@precise64:~/mako-tests$ python main.py
<p>The page that you were looking for was not found.
Go back to the <a href="/">home page</a> or let us know about any pages that may have been moved at <a href="mailto:google.com">google.com</a>.
</p>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment