rajasekhar911 schrieb:
> Hi,
>
> I have an application running in cherrypy. The exposed methods return
> an XML document which i parse to make changes to the UI.
>
> I want to shift this application to TG2. How can I make the TG2
> controller to return the XML document?
> Can genshi do that for me? Or should I use the TGWebServices(http://
> pypi.python.org/pypi/TGWebServices)?
I use genshi. It works roughly like this:
from tg import response
@expose() # no engine here, because we need control over content-type
def serve_xml(self, ...):
template_content = load_template_content() # somehow get the
template, could be a string as well
t = MarkupTemplate(template_content)
args = create_argument_dict()
response.set_header("Content-type", "whatever/you-like")
return t.generate(**args).render()
Diez
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---