0
我有一个web.py应用程序,其中包含以下服务器代码。GET()只需要2个参数(给出4个参数)
import web
import mod1
urls = (
'/(\w*)/(c|r|u|d)/(.*)', '\\1.\\2',
)
if __name__ == "__main__":
app = web.application(urls, globals())
app.run()
mod1.py
包含
class c:
def POST(self):
return "C"
class d:
def DELETE(self):
return "d"
class u:
def POST(self):
return "u"
class r:
def GET(self, _id):
return "v={0}".format(_id)
现在请求http://.../mod1/r/3
回报GET() takes exactly 2 arguments (4 given)
。
这里有什么问题?
但是在[tutorial](http://webpy.org/docs/0.3/tutorial)中,它表示“'1”被第一次捕获正则表达式所取代;任何**剩余的**捕获都会得到传递给你的功能。“ –
[本页](http://webpy.org/cookbook/url_handling)没有提及它,似乎没有关于此的更多信息。坦率地说,我自己并不使用'web.py'。这可能是教程不正确。 :-) –
@GenghisKhan:对[代理码](https://github.com/webpy/webpy/blob/master/web/application.py#L430)的快速扫描显示没有这样的组删除。会看起来更进一步,但到目前为止,它看起来像教程是错误的。 –