[Zope] Accessing .gif on disk with Python Product?

Martijn Pieters mj@digicool.com
Mon, 7 Aug 2000 18:41:18 +0200


On Mon, Aug 07, 2000 at 01:38:56PM -0300, Kevin Howe wrote:
> Right you are, here's how I solved it:
> 
> # __init.py__ for myProduct
> 
> misc_={
>   'chooserIcon': ImageFile('images/chooserIcon.gif',globals()),
>   }
> 
> # DTML file
> 
> <img src="<dtml-var absolute_url>/misc_/myProduct/chooserIcon" border=0>

misc_ is a root level object. Using absolute_url you are acquiring it into
your Instance URL, which is not necessary (and will hamper off-server
caching). Use &dtml-SCRIPT_NAME; instead (which will give you the absolute url
of the root object in all cases):

  <img src="&dtml-SCRIPT_URL;/misc_/myProduct/chooserIcon" border=0>  

-- 
Martijn Pieters
| Software Engineer            mailto:mj@digicool.com
| Digital Creations          http://www.digicool.com/
| Creators of Zope               http://www.zope.org/
| ZopeStudio: http://www.zope.org/Products/ZopeStudio
-----------------------------------------------------