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

Sebastian Ware sebastian at urbantalk.se
Sun Apr 27 09:04:28 EDT 2008


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...

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



More information about the Grok-dev mailing list