Saturday 15 August 2015

python - Mark string as safe in Mako -


I am using pylons with macro templates and I want to avoid typing it all the time:

  $ {h.some_function_that_outputs_html () | N}  

I want to mark the function in any way, or secure as a variable (you can do this in Django) so I need to do pipe-n all the time is not. any idea?

I just found out that if you put the html method in your class

<> def __html __ (self): Return Unicode (self)

So I did: / Code>

This is basically what h. Does literal.


No comments:

Post a Comment