Just Launched: You can now import projects and releases from Google Code onto SourceForge
We are excited to release new functionality to enable a 1-click import from Google Code onto the Allura platform on SourceForge. You can import tickets, wikis, source, releases, and more with a few simple steps. Read More
etc. as well as a StyleSheet.css in the main directory, I need a convenient
way to refer to these from subdirectories.
I do this by prepending a string I call the "root dir" to my relative links:
Returns the root directory of the site appropriate for prepending to
relative paths, such as Graphics/foo.gif. Will return '', '../', '../../', etc.
parts = self.request().urlPath().split('/')
numExtraParts = len(parts) - parts.index('MyContext') - 2
return '../' * numExtraParts
So I might have a link that looks like this:
'%sStyleSheet.css' % self.rootDir()
My host name, WebKit adapter name and context name can change at any time
and the existing code will work fine since I use ../
Upon deployment to the production environment, I could leave this as is, or
change rootDir() to return 'http://www.host.com/';.