well, just ran into another problem: i want to serve the data returned from one controller as text/html and application/xml. but it turns out that the way web browsers specify their preferences, paste.util.mimeparse.best_match determines application/xml as the content type to return to browsers.
the way i solved this problem - and a possible avenue to solve the original one: monkey-patching tg.decorators.Decoration by overwriting its lookup_template_engine method. does this sound like a somewhat reasonable solution? or is it bound to break in the future? best regards, robert On Oct 13, 10:19 am, Robert Forkel <[email protected]> wrote: > hi all, > i'm somewhat stuck trying to avoid the deprecated tg_format parameter > in tg2.0.3. > > i want to expose the data returned from a controller in different > content_types, in particular xhtml and kml. and since i request the > kml from javascript using GDownloadUrl [1] - which doesn't allow > specification of additional headers - i have to specify the mimetype > in the URL. > > so trying to avoid tg_format, i appended ".kml" to the URL path. but > while request.response_type is correctly set to "application/ > vnd.google-earth.kml+xml" (i guess because of the entry in mimetypes), > tg2 still fails to pick the correct template engine. this is because i > had to specify the content_type in the expose decorator as > "application/vnd.google-earth.kml+xml; charset=UTF-8", to make webob > not complain about a missing charset. > > so the check in decorator.py line 121: > if hasattr(request, 'response_type') and request.response_type in > self.engines: > fails. > > from my point of view, having a way to specify the charset for expose > in a separate parameter would do the trick - if that's propagated to > webob accordingly. > > [1]http://code.google.com/apis/maps/documentation/reference.html#GDownlo... --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

