[Zope-dev] How to put "<", ">" in HTML attributes?

Christian Theune ct at gocept.com
Wed Aug 20 13:59:37 EDT 2008


On Wed, 2008-08-20 at 19:34 +0200, Hermann Himmelbauer wrote:
> Hi,
> I have a page template, that should have the characters "<" and ">" in the 
> resulting HTML code, e.g.:
> 
> <input type="hidden", name="xyz", value="<ABC>" />
> 
> Zope3 makes a &lt; / &rt; out of the "<>" characters:
> 
> <input type="hidden", name="xyz", value="&lt;ABC&rt;"
> 
> Is there a way to get around this automatic conversion? I tried it via:
> 
> <input ....
>     tal:attributes="value python:'<ABC>'" />
> 
> But this makes no difference.
> 
> Any clues?
> 
> Best Regards,
> Hermann
> 
> P.S.: I know, this seems to make no sense, but the page is a template for 
> another, foreign application, which needs this specific values as 
> placeholders and which I can not adapt...

My memory says and the HTML validator acknowledges it: this *is* broken.

PT is designed to not do that.

Here's how it *might* work:

Take a view that generates the broken HTML snippet, like:

class View:

   def code(self):
      return '<input value="<broken>"/>'

And in your template do:

<div tal:replace="structure view/code"/>

I didn't test it and I'm not sure it works. It might, though.

Christian

PS: This makes the little internet elves cry.

-- 
Christian Theune · ct at gocept.com
gocept gmbh & co. kg · forsterstraße 29 · 06112 halle (saale) · germany
http://gocept.com · tel +49 345 1229889 7 · fax +49 345 1229889 1
Zope and Plone consulting and development
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://mail.zope.org/pipermail/zope-dev/attachments/20080820/16711bbe/attachment.bin 


More information about the Zope-Dev mailing list