문제

Is there a way to get CherryPy to respond to a url that includes a period, such as http://some/base/path/oldscript.py ? I have a number of old CGI scripts that were called like that, and I'm trying to roll them into a nice pretty CherryPy web app - but I don't want to break all the bookmarks and the like that still point to the CGI scripts. Ideally the same method would respond to the url regardless of if it has a .py or not.

도움이 되었습니까?

해결책

Turns out using an _ in the method definition works as a dot/period. This does mean I have to have two function definitions if I want to be able to call it either with or without the .py, but since I can easily call the one function from the other, this is a minor quibble.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top