I have a simple TurboGears 2 script, named app.py:
#!/usr/bin/env python3
from wsgiref.simple_server import make_server
from tg import expose, TGController, AppConfig
class RootController(TGController):
@expose()
def all__things(self):
return "Hello world!"
config = AppConfig(minimal=True, root_controller=RootController())
print("Serving on port 5000...")
httpd = make_server('', 5000, config.make_wsgi_app())
httpd.serve_forever()
When I run app.py and visit http://localhost:5000/all__things, I see "Hello world!" as expected. But these URLs also work:
http://localhost:5000/all--things
http://localhost:5000/all@@things
http://localhost:5000/all$$things
http://localhost:5000/all++things
http://localhost:5000/all..things
http://localhost:5000/all,,things
As well as combinations:
http://localhost:5000/all-_things
http://localhost:5000/all_-things
http://localhost:5000/all-@things
http://localhost:5000/all@-things
http://localhost:5000/all$@things
http://localhost:5000/all@$things
Et cetera...
What is the complete list of characters that can be substituted for an underscore in TurboGears URLs?
Also, can this feature be restricted to only substitute certain characters? Ideally, I want URLs with dashes (http://localhost:5000/all--things) to work, and URLs with underscores (http://localhost:5000/all__things) or any other strange characters to not work.