pipe n not always working

27 views
Skip to first unread message

YaPel

unread,
Dec 31, 2012, 10:20:04 AM12/31/12
to mako-d...@googlegroups.com
Hi guys, I'm having some issues with the mako template, I have this little snippet

              me = c.me.getMessage()
              r = re.compile(r'(www.[^ ]+)')
              message = unescape(r.sub(r'<a href="http://\1" target="_blank">\1</a>', me)).replace('&quot;', '"').replace('&#34;','"')
              return message

 on my controler, basically, it looks for things that look like a web address, and then transform it into a proper html tag, and then I simply load that in a mako controller:

${c.message | n}

the thing is.. it looks like in some configurations that, | n isn't working, I can see the html tag instead of the hyperlink, any idea on what may be going on?? thanks!

Michael Bayer

unread,
Dec 31, 2012, 11:46:49 AM12/31/12
to mako-d...@googlegroups.com
"| n" is pretty absolute, you'd need to illustrate a test case where it doesn't work to confirm that.


--
You received this message because you are subscribed to the Google Groups "Mako Templates for Python" group.
To view this discussion on the web visit https://groups.google.com/d/msg/mako-discuss/-/QM0nkA5td5YJ.
To post to this group, send email to mako-d...@googlegroups.com.
To unsubscribe from this group, send email to mako-discuss...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mako-discuss?hl=en.

Federico Apelhanz

unread,
Dec 31, 2012, 12:03:19 PM12/31/12
to mako-d...@googlegroups.com
Thats the strange thing about it, I don't know how to replicate the issue, its like some computers show it okey, and some add some sort of escaping, I'm not blaming excactly mako, but don't know what to do to be honest.

2012/12/31 Michael Bayer <mik...@zzzcomputing.com>

Michael Bayer

unread,
Dec 31, 2012, 12:08:59 PM12/31/12
to mako-d...@googlegroups.com
it could be that the string being sent into "message" in the first place is already escaped in some way.    As for difference among machines, depends on if you're talking about a multi-host environment, maybe some machines don't have the same version of the code running, or you're just trying it locally on different machines, then perhaps some python version difference or other library version is changing.  Distilling it down to a test case in whatever way shows the issue would be the first step.
Reply all
Reply to author
Forward
0 new messages