[Zope] including arbitrary files in zope products

Johan Carlsson johanc at easypublisher.com
Sat Sep 4 07:09:05 EDT 2004


Dieter Maurer wrote:

> Johan Carlsson wrote at 2004-9-3 08:55 +0200:
> 
>>...
>>For Images you can use
>>
> 
>>from Globals import ImageFile
> 
>>file=ImageFile('www/image.gif', globals())
> 
> Despite its name, you can use "ImageFile" for arbitrary files and not
> only for images.

Provide it actually can guess the content_type.
If content_type is not important it may not be a big problem
if the guess fails (in which case the content_type will be
set to: 'image/%s' % path[path.rfind('.')+1:] ).

I would subclass ImageFile and override the __init__ with an
extra content_type argument. But that's me :-)


-- 
Johan Carlsson          Tel: + 46 8 31 24 94
Colliberty              Mob: + 46 70 558 25 24
Torsgatan 72            Email: johanc at easypublisher.com
SE-113 37 STOCKHOLM


More information about the Zope mailing list