The problem is that request doesn't support item assignment. I recall running into this problem before. Maybe in a previous version of TG2 it did, but as it stands now, you can't just assign a mime type in the request as if it were a dictionary.
-Min On Aug 27, 5:02 pm, "Diez B. Roggisch" <[email protected]> wrote: > Min schrieb: > > > Of course I did. That's why I referenced the mimetypes module you > > mentioned. But it doesn't get around the fact that the mimetype is set > > in the decorator before the actual controller method, so AFAIK, > > there's no way to give it information gathered from within the method. > > If I may quote myself (from the *first* post I did in this thread): > > """ > @expose(content_type=CUSTOM_CONTENT_TYPE) > def image(self, id): > image = Image.get(id) > pylons.request['Content-Type'] = image.mime_type > return image.data > """ > > So, instead of "image.mime_type", "mimetyes.guess_type(filename)[0]". > > 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 -~----------~----~----~----~------~----~------~--~---

