adobe flex; return xml via turbogears/django

Diez B. Roggisch deets at nospam.web.de
Thu May 29 10:29:56 EDT 2008


Sells, Fred wrote:

> please excuse slightly off-topic; cannot access turbogears mailing list at
> the moment.
> 
> There was an excellent video by James Ward that showed using turbogears to
> return json data to adoble's flex UI.  It simply used
> 
> @expose("JSON")
> def xxxx():
> ...
> return dict(x=1, ...)
> 
> Is there any equivalent for xml, such as
> @expose("XML")
> def ....
> return myElementTreeRoot
> 
> I need to have more attribute data (for a grid) than I can cleanly do in
> json and while pyamf might do the trick, It adds a layer of "magic code"
> that I cannot sell to my team.  Also with xml and json, I can do my UI
> design with the url pointing to a test data file, then build the backend
> to match.
> 
> any ideas?

Why don't you create KID-template like this:

<div py:strip="True">${root}</div>

and in the controller say

@expose("thexmltemplate")
def ...
   return dict(root=myElementTreeRoot)

Diez



More information about the Python-list mailing list