-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
smart idea, thanks. but i don't really want a function for every mime type :). thanks, and hope for more suggestions. alex lilspikey wrote: > > On Jan 10, 3:02 am, alex bodnaru <[EMAIL PROTECTED]> wrote: >> hi friends, >> >> setting @expose(content_type="image/jpeg") allows me to serve a string >> blob for a jpeg image. >> >> could i set the content_type later in the function, after my code >> decides it's type? >> >> thanks in advance, >> > > > Well one way is to simply call another function that has been > decorated with @expose(content_type="image/jpeg") later on. e.g.: > > @expose() > def something(self): > # decide stuff here > if serve_jpeg: > return self._as_jpeg(jpeg_data) > > @expose(content_type="image/jpeg") > def _as_jpeg(self,jpeg_data): > return jpeg_data > > That would leave _as_jpeg() exposed and callable, so you might want to > use it as a plain function, so that it can't be called directly. > > cheers, > John > > > -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iQCVAwUBR4XvLNpwN1sq38njAQJeQAP+IS41+pelAVFPxDrvsY2wHUyBDTfocyen bhhY1AfjOamMBiXhhiPxfFVJzPys3BT2NzCH1cKdlgKx+Bd5S/JqvI4Uv+Uv849U 6XlCeCLoUarDjSBaCsltWmiQGhpvCqahB4wdQjxTASifljIyXRCKJ1KU0MZafqAM ertHuTMS1oE= =6pat -----END PGP SIGNATURE----- --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

