Re: [Distutils] PEP 438 - Transition Phase 1

2013-05-19 Thread Lennart Regebro
On Mon, May 20, 2013 at 8:21 AM, Donald Stufft  wrote:

> He also said to just put the javascript in the body of the script but xml 
> escape it. Which I did, and when the template was rendered the data was still 
> xml escaped and again invalid javascript.

I think there is a misunderstanding. When you are putting it into the
template itself, you typically don't need to do anything. You just add
it to the template.

//Lennart
___
Distutils-SIG maillist  -  Distutils-SIG@python.org
http://mail.python.org/mailman/listinfo/distutils-sig


Re: [Distutils] PEP 438 - Transition Phase 1

2013-05-19 Thread Marius Gedminas
On Mon, May 20, 2013 at 02:21:05AM -0400, Donald Stufft wrote:
> 
> On May 20, 2013, at 2:18 AM, Lennart Regebro  wrote:
> 
> > On Sun, May 19, 2013 at 10:20 PM, Donald Stufft  wrote:
> >> Hrm, ZPT doesn't seem to be stripping the CDATA or unescaping the strings?
> >> 
> >> https://gist.github.com/dstufft/5608838 is what i have in the template 
> >> file and that appears verbatim in the output?
> > 
> > Yes? It will escape *data* inserted into the template (unless told not
> > to), but what is in the template will appear in the output unescaped.
> > I'm not sure how any template system can work otherwise, but perhaps
> > I've been using Zope too long. :-)
> > 
> > //Lennart
> 
> Maybe you can tell me what I'm doing wrong?

Using zope.pagetemplate. ;)

More seriously, zope.pagetemplate has two parsing modes: HTML and XML.
Nobody actually uses the XML mode (pt files start with an 
declaration, all tal/metal namespaces must be explicitly defined using
xmlns:tal=url-that-nobody-can-remember).  The HTML mode allows you to
write Javascript just like you would do it in a browser, with no extra
XML-quoting:

  

Does this not work for you?  I'm currently looking at a Zope3 app that
does precisely this in its working page templates.

> I need to insert a