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/';.