[Grok-dev] Re: absolute url for 'static' ?

Michael Haubenwallner michael at d2m.at
Sun Apr 27 10:12:02 EDT 2008


Sebastian Ware schrieb:
> 26 apr 2008 kl. 22.10 skrev Martijn Faassen:
>> In python code in a view, I think you can just do this:
>>
>> self.static['foo.css']()
> 
> I can confirm this, and some other useful stuff in case you want to to 
> some manipulation of files in the static directory...
> 

Thank you both for providing help with this issue.

I suggest adding the detailed info Sebastian provided to a 'static 
how-to' document on grok.zope.org

> the zope.app.publisher.browser.fileresource.FileResource
> 
>    self.static['file.css']
> 
> absolute url to file.css in static directory
> 
>    self.static['file.css']()
> 
> (local filesystem) path to file.css in static directory
> 
>    self.static['file.css'].context.path
> 
> mime-filetype of file in static directory (i.e. "text/css")
> 
>    self.static['file.css'].context.content_type
> 
> datetime last modified (lmh as string: 'Tue, 05 Feb 2008 13:53:44 GMT', 
> lmt as float: 1202219624.0)
> 
>    self.static['file.css'].context.lmh
> 
> absolute url to static directory
> 
>    self.static()
> 
> (local filesystem) path to static directory
> 
>    self.static.context.path
> 
> mvh Sebastian

Regards
Michael

-- 
http://www.zope.org/Members/d2m
http:/planetzope.org


More information about the Grok-dev mailing list