0

这是为应用程序声明地址的代码

def includeme(config):
    a = config.add_handler  
    a('fileupload', '{lang}/case/fileupload{sep:/*}{name:.*}', ImageUpload)

这里是 ImageUpload 类

@action(route_name='fileupload')
class ImageUpload():

    def __init__(self,request):

    @action(request_method='GET', renderer="json")
    def get(self):        

    @action(request_method='POST', xhr=True, accept="application/json", renderer='json')
    def post(self):

当我尝试转到 ru/case/fileupload/ 时,它什么也得不到,问题是什么以及如何解决?

4

2 回答 2

0

您需要命名您的操作,目前它们被命名为“get”和“post”。你可能想@action(name='index', ...)在你的方法上使用,然后config.add_handler(..., action=index').

于 2013-07-04T16:49:45.680 回答
0

只有我发现它看起来像的决定

def includeme(config):
   a = config.add_handler
   a('modeluploadget', '/fileupload{sep:/*}{name:.*}', ModelUpload, request_method='GET', action='get')
   a('modeluploadpost', '/fileupload{sep:/*}{name:.*}', ModelUpload, request_method='POST', action='post') 
   a('modeluploaddelete', '/fileupload{sep:/*}{name:.*}', ModelUpload, request_method='DELETE', action='delete')
于 2013-07-05T11:55:18.143 回答