I do not think that I have something missing. Again, I'm kind of a beginner.
def GET(self, filename):
name = urllib.unquote(filename)
full = path.abspath(path.join(STATIC_PATH, filename))
assert full[:len(STATIC_PATH)] == STATIC_PATH, "bad path"
return open(full).read()
Edit: I understand that this will return the wrong HTTP error code if the file does not exist (at least under web.py). I will fix this.
source
share