URI Traversal
If the previous hello.py script was saved as index.py then it could be executed as any of:
http://my_site.tld/dir/path/
http://my_site.tld/dir/path/index
http://my_site.tld/dir/path/index.py
The Publisher handler will execute the module named in the URI. If there is no module in the URI it will look for index.py.
The following script has two functions and it is possible to choose which one will be executed.
s = """\ <html><body> <h2>Hello %s!</h2> </body></html> """ def index(): return s % 'World' def everybody(): return s % 'everybody'
The function to be called can be passed in the URI. If the previous script was saved as index.py the everybody() function could be executed as any of:
http://my_site.tld/dir/path/index.py/everybody
http://my_site.tld/dir/path/index/everybody
http://my_site.tld/dir/path/everybody
If no function is found in the URI then the function called by default is the index() function.