Absolute path for static assets/ Get file modified time

2011-11-16 Thread Jay T
How do I get the absolute path for static assets ? The reason I need the absolute path is to determine the last modified time of a specific file so I can append it to my static resources like JS and CSS files. I wrote a Mako template def like this but it fails at : here =

Re: Absolute path for static assets/ Get file modified time

2011-11-16 Thread Michael Merickel
You will need to use the pkg_resources api from the Python stdlib. Currently (this will be fixed in 1.3) there is no public API for computing paths. import pkg_resources asset_path = 'mypackage:static/favicon.ico' package, file = asset_path.split(':', 1) abs_path =

Re: Absolute path for static assets/ Get file modified time

2011-11-16 Thread Jay T
That worked. Thanks ! Jay On 11/16/11 5:46 PM, Michael Merickel wrote: You will need to use the pkg_resources api from the Python stdlib. Currently (this will be fixed in 1.3) there is no public API for computing paths. import pkg_resources asset_path = 'mypackage:static/favicon.ico'