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
-~----------~----~----~----~------~----~------~--~---