Using os.path.join for web URLs is bad

Issue #47 resolved
Philipp Feigl
created an issue

treebeard_css and treebeard_js uses os.path.join to build the URL for the css file. This fails on windows systems, as the directory seperator on windows is \ (backslash). All browsers - os independently - expect / (forward-slash).

While the files are actually found in my setup, CSS files cannot reference the images, as the path actually ends up beeing something like "http://page/static/treebeard%5Ctreebeard-admin.css"

Comments (2)

  1. Philipp Feigl reporter

    Fixed it using the following code locally

    css_file = '/'.join([path.rstrip('/'), 'treebeard', 'treebeard-admin.css'])
    js_file = '/'.join([path.rstrip('/'), 'treebeard', 'treebeard-admin.js'])

    Got no hg setup here currently, would have submitted a patch elsewise

  2. Log in to comment