Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #1070 (closed defect: fixed)

Opened 13 years ago

Last modified 12 years ago

[PATCH] for controllers to override the 'format' via returned dict's 'tg_format'

Reported by: dalke Owned by: anonymous
Priority: normal Milestone:
Component: CherryPy Version: 0.9a5
Severity: normal Keywords:


The comment at the bottom of http://trac.turbogears.org/turbogears/ticket/341 states

"""To output XML, use the XML serializer. To do this, just add tg_format="xml" to the dict which you return from your controller."""

I found no mention of "tg_format" in the documentation though.

I needed this feature because I have a controller method which looks at the "format" form variable and decides for itself if it should return XML, text, json, etc. (See ticket 1066 for the patch to support the parameter named 'format' in the query string.)

I added the "tg_format": "xml" to the returned dictionary but that did not work. Included is the one line patch to make it work. Or rather it will be .. looks like I need to start a ticket before I can attach files. Grr...


controllers.py.diff Download (615 bytes) - added by dalke 13 years ago.

Change History

Changed 13 years ago by dalke

comment:1 Changed 13 years ago by alberto

  • Status changed from new to closed
  • Resolution set to fixed

Comitted at [1805]. Thanks!

Note: See TracTickets for help on using tickets.