[Zope] Re: Filesystem Page Template lowercase-ifying all my tags

2005-10-26 Thread Floyd May
An update -
It appears as though this problem is due to the content-type being set
inappropriately (probably text/html).  I'm attempting to render XML,
but each of the templates only contains a piece of my final output XML
file; therefore, I don't have the '?xml ... ?' header in the file. 
From a perusal of the source for FSPageTemplate, this appears to be
the only way to get the Content-Type set to 'text/xml'.  Basically,
I'm constructing a VERY large XML file using a python script that
buffers writes to REQUEST.RESPONSE.  The script calls the page
templates, and then writes the rendered page templates to
REQUEST.RESPONSE through the buffering mechanism.

I have attempted adding .metadata files for each of my templates, with
the following content:
---8--
[default]
content_type=text/xml
---8--
It didn't work.  I'm still at a loss for how to make this all happen,
I can't have my XML tags get lower-case-ified.  Please help!

 Zope 2.7.7-final, python 2.3.5, freebsd5
 Page Templates 1.4.0
CMF 1.4.8

fm

On 10/25/05, Floyd May [EMAIL PROTECTED] wrote:
 I have a product that installs some filesystem page templates into a plone 
 site's portal_skins.  The templates are exactly the same as their 
 created-through-ZMI counterparts, yet the filesystem templates render with 
 all their tags lower-cased, whereas the ZMI-created templates preserve case.  
 Why is this happening?

  Zope 2.7.7-final, python 2.3.5, freebsd5
  Page Templates 1.4.0

  Thanks!
  fm

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Re: Filesystem Page Template lowercase-ifying all my tags

2005-10-26 Thread Fred Drake
On 10/26/05, Floyd May [EMAIL PROTECTED] wrote:
 It appears as though this problem is due to the content-type being set
 inappropriately (probably text/html).  I'm attempting to render XML,
 but each of the templates only contains a piece of my final output XML
 file; therefore, I don't have the '?xml ... ?' header in the file.
 From a perusal of the source for FSPageTemplate, this appears to be
 the only way to get the Content-Type set to 'text/xml'.  Basically,

Unfortunately, that's true for the current code.  Julien Anguenot and
I started working on this problem (along with some other aspects of
the XML vs. HTML behavior) based on the Zope 3 implementation for page
templates.  The work isn't done yet, though the aspect you're
interested in is pretty straightforward.

That's only for the Zope 3 version of the code, however.  For now,
your best bet may be to subclass the PageTemplateFile class (or
whichever derived class of that that's relevant to you) and override
the _cook_check() method to do what you need it to do.  If you're
using a file-system view, you likely need to arrange for your new
class to be used for some new filename extension; I'm not sure how to
arrange for that.


  -Fred

--
Fred L. Drake, Jr.fdrake at gmail.com
Society attacks early, when the individual is helpless. --B.F. Skinner
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Re: Filesystem Page Template lowercase-ifying all my tags

2005-10-26 Thread Chris Withers

Floyd May wrote:

I'm constructing a VERY large XML file using a python script that
buffers writes to REQUEST.RESPONSE.  The script calls the page
templates, and then writes the rendered page templates to
REQUEST.RESPONSE through the buffering mechanism.

I have attempted adding .metadata files for each of my templates, with
the following content:
---8--
[default]
content_type=text/xml
---8--
It didn't work.  I'm still at a loss for how to make this all happen,
I can't have my XML tags get lower-case-ified.  Please help!

 Zope 2.7.7-final, python 2.3.5, freebsd5
 Page Templates 1.4.0
CMF 1.4.8


Yes, it's a bug in CMF 1.4's parsing of FSPageTemplates that stomps on 
the content type and sets it back to text/html every time.


Can you upgrade to CMF 1.5?

cheers,

Chris

--
Simplistix - Content Management, Zope  Python Consulting
   - http://www.simplistix.co.uk
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Re: Filesystem Page Template lowercase-ifying all my tags

2005-10-26 Thread Floyd May
I found a way to hack around it.  It's definitely ugly, though.

Basically, I have a python script that calls page templates and
buffers the results as it writes out to REQUEST.RESPONSE.  Each page
template is *just a portion* of my final output XML file.  Since all
of the scripts and templates that I'm using are read from the
filesystem, they are the filesystem-equivalents to the ZODB-stored
objects.

Specifically, I discovered that the FSPageTemplate from CMFCore will
set the content_type attribute on the object to 'text/xml' if the file
begins with '?xml'.  Otherwise, when it sees the xml-or-html-looking
content, it assumes a content_type of 'text/html', which lowercases
all the tags.

So I added an xml header to all of my page templates, and I strip it
back out inside the python script that calls the template (so that I
don't have the XML header repeated over and over in my final output
XML file).  Ugly, yes, but it does work.

fm

On 10/26/05, Fred Drake [EMAIL PROTECTED] wrote:
 On 10/26/05, Floyd May [EMAIL PROTECTED] wrote:
  It appears as though this problem is due to the content-type being set
  inappropriately (probably text/html).  I'm attempting to render XML,
  but each of the templates only contains a piece of my final output XML
  file; therefore, I don't have the '?xml ... ?' header in the file.
  From a perusal of the source for FSPageTemplate, this appears to be
  the only way to get the Content-Type set to 'text/xml'.  Basically,

 Unfortunately, that's true for the current code.  Julien Anguenot and
 I started working on this problem (along with some other aspects of
 the XML vs. HTML behavior) based on the Zope 3 implementation for page
 templates.  The work isn't done yet, though the aspect you're
 interested in is pretty straightforward.

 That's only for the Zope 3 version of the code, however.  For now,
 your best bet may be to subclass the PageTemplateFile class (or
 whichever derived class of that that's relevant to you) and override
 the _cook_check() method to do what you need it to do.  If you're
 using a file-system view, you likely need to arrange for your new
 class to be used for some new filename extension; I'm not sure how to
 arrange for that.


   -Fred

 --
 Fred L. Drake, Jr.fdrake at gmail.com
 Society attacks early, when the individual is helpless. --B.F. Skinner

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )