[Grok-dev] Conditional linking to static images

Darryl Cousins darryl at darrylcousins.net.nz
Tue Jul 3 16:57:43 EDT 2007


Hi,

On Tue, 2007-07-03 at 15:10 -0300, Luciano Ramalho wrote:
> Hello,
> 
> How do I obtain the filesystem path to the static directory? In some
> Kirbi views I need to check whether we have the book cover
> corresponding to a book, and those will be stored as static images. If
> we have the cover, an URL to it will be generated, otherwise we will
> substitute the URL to a placeholder image.

Would this be what you need?:

os.path.join(os.path.dirname(__file__), 'static')

Regards,
Darryl

> 
> I've been reading about DirectoryResource but it seems it was not
> designed with this use case in mind.
> 
> Cheers,
> 
> Luciano
> _______________________________________________
> Grok-dev mailing list
> Grok-dev at zope.org
> http://mail.zope.org/mailman/listinfo/grok-dev



More information about the Grok-dev mailing list