List Info

Thread: Buffet Question - Determining content-type




Buffet Question - Determining content-type
user name
2006-03-23 15:55:49
I was wondering how to return a Kid template through Buffet
and
CherryPy as xml.

I saw support for this in TurboKid but could not find a way
to pass the
format parameter to the render function through Buffet.

For now, I tweaked my version of buffet to allow for:
using_template('template_name', 'format')

But if there's another way to do this, I'd like to know.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at http://
groups.google.com/group/cherrypy-users
-~----------~----~----~----~------~----~------~--~---

Buffet Question - Determining content-type
user name
2006-03-23 22:47:13
Hi Andrew,

Andrew wrote:
> I was wondering how to return a Kid template through
Buffet and
> CherryPy as xml.

Well, this hasn't come up before 

> I saw support for this in TurboKid but could not find a
way to pass the
> format parameter to the render function through Buffet.
> 
> For now, I tweaked my version of buffet to allow for:
> using_template('template_name', 'format')
> 
> But if there's another way to do this, I'd like to
know.

Well, there is another way, but your "tweak"
might be better.

     cherrypy.expose
     using_template('test')
     def index(self):
         ct = 'text/xml'
         cherrypy.response.headers['Content-type'] = ct
         return {'test':'yo!'}

How does TurboGears set the content type?  Maybe I should do
something 
similar in Buffet, or adopt your tweak.

Christian
http://www.dowski.com


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at http://
groups.google.com/group/cherrypy-users
-~----------~----~----~----~------~----~------~--~---

Buffet Question - Determining content-type
user name
2006-03-23 23:01:49
On 3/23/06, Christian Wyglendowski <christiandowski.com> wrote:
> How does TurboGears set the content type?  Maybe I
should do something
> similar in Buffet, or adopt your tweak.

TurboGears' expose() can take a content_type parameter.
Most expose()
parameters can also be overridden in the dictionary by
prepending
"tg_" on the name of the parameter. That
doesn't appear to be the case
with content_type for some reason.

Kevin

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at http://
groups.google.com/group/cherrypy-users
-~----------~----~----~----~------~----~------~--~---

Buffet Question - Determining content-type
user name
2006-03-24 19:52:42
Sorry, I'm a dope.  I forgot a key piece of information in
my post.

Setting the Content-Type as you mentioned does set the
content-type
returned to the browser, but it capatalizes all of the XML
tags.
That's why I had to tweak buffet.

If you're interested here's my modified version:

http://www.exit66.com/static/generic_template_filter.py


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at http://
groups.google.com/group/cherrypy-users
-~----------~----~----~----~------~----~------~--~---

[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )