[Grok-dev] Re: grok.PageTemplate and content types

Philipp von Weitershausen philipp at weitershausen.de
Fri Jan 12 13:11:13 EST 2007


Rocky Burt wrote:
> On Fri, 2007-12-01 at 15:27 +0100, Philipp von Weitershausen wrote:
>> Jan-Wijbrand Kolman wrote:
>>> class Foo(grok.View):
>>>     grok.template('specialfoo', mime_type='application/xml')
>>>
>>> and
>>>
>>> grok.PageTemplate("""\
>>>     <html>
>>>     ...
>>>     </html>
>>>     """, mime_type="application/xml")
>>>
>>> Would that work?
>> Sure, that would work for me, except I'd suggest calling it content_type 
>> as that seem sto be used by zope.pagetemplate itself.
> 
> Sorry, I must speak up here.  I adamantly recommend against using
> content_type.  This gets *sooooo* confusing when dealing with systems
> that are built to work with or supporting CMSs.  Use mime type... much
> more obvious and clean imho.

-1 on mime type, for two reasons:

* The HTTP header is called Content-Type, like it or not.
* The ZPT API already uses content_type


-- 
http://worldcookery.com -- Professional Zope documentation and training
2nd edition of Web Component Development with Zope 3 is now shipping!



More information about the Grok-dev mailing list