{"action":"created","issue":{"url":"https://api.github.com/repos/hfaran/Tornado-JSON/issues/59","labels_url":"https://api.github.com/repos/hfaran/Tornado-JSON/issues/59/labels{/name}","comments_url":"https://api.github.com/repos/hfaran/Tornado-JSON/issues/59/comments","events_url":"https://api.github.com/repos/hfaran/Tornado-JSON/issues/59/events","html_url":"https://github.com/hfaran/Tornado-JSON/issues/59","id":55303454,"number":59,"title":"Stacked decorators with @schema.validate and @gen.coroutine","user":{"login":"malexh","id":4376885,"avatar_url":"https://avatars.githubusercontent.com/u/4376885?v=3","gravatar_id":"","url":"https://api.github.com/users/malexh","html_url":"https://github.com/malexh","followers_url":"https://api.github.com/users/malexh/followers","following_url":"https://api.github.com/users/malexh/following{/other_user}","gists_url":"https://api.github.com/users/malexh/gists{/gist_id}","starred_url":"https://api.github.com/users/malexh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/malexh/subscriptions","organizations_url":"https://api.github.com/users/malexh/orgs","repos_url":"https://api.github.com/users/malexh/repos","events_url":"https://api.github.com/users/malexh/events{/privacy}","received_events_url":"https://api.github.com/users/malexh/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/hfaran/Tornado-JSON/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/hfaran/Tornado-JSON/labels/in_progress","name":"in_progress","color":"ededed"}],"state":"open","locked":false,"assignee":{"login":"hfaran","id":2450496,"avatar_url":"https://avatars.githubusercontent.com/u/2450496?v=3","gravatar_id":"","url":"https://api.github.com/users/hfaran","html_url":"https://github.com/hfaran","followers_url":"https://api.github.com/users/hfaran/followers","following_url":"https://api.github.com/users/hfaran/following{/other_user}","gists_url":"https://api.github.com/users/hfaran/gists{/gist_id}","starred_url":"https://api.github.com/users/hfaran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hfaran/subscriptions","organizations_url":"https://api.github.com/users/hfaran/orgs","repos_url":"https://api.github.com/users/hfaran/repos","events_url":"https://api.github.com/users/hfaran/events{/privacy}","received_events_url":"https://api.github.com/users/hfaran/received_events","type":"User","site_admin":false},"milestone":null,"comments":11,"created_at":"2015-01-23T16:44:07Z","updated_at":"2015-03-03T19:33:37Z","closed_at":null,"body":"First, thanks for developing this extension. It is extremely useful.  Now for the issue.\r\nWhen I use the `@schema.validate` decorator as specified, it works perfectly.  Example:\r\n\r\n```python\r\nclass ProfilesAPIHandler(APIHandler):\r\n\t__url_names__ = [\"profiles\"]\r\n\r\nclass ProfileListHandler(ProfilesAPIHandler):\r\n    @schema.validate(...)\r\n    def get(self):\r\n        ...\r\n\r\nclass ProfileIdHandler(ProfilesAPIHandler):\r\n    @schema.validate(...)\r\n    def get (self, account_id):\r\n        ...\r\n```\r\n\r\nThe above works great!\r\n\r\nNow, I want to use `@gen.coroutine` to do some async calls and speed up requests.  When I add in the decorator, I get doubled routes.  For example:\r\n\r\n```python\r\nclass ProfileListHandler(ProfilesAPIHandler):\r\n    @schema.validate(...)\r\n    @gen.coroutine\r\n    def get (self):\r\n        ...\r\n\r\nclass ProfileIdHandler(ProfilesAPIHandler):\r\n    @schema.validate(...)\r\n    @gen.coroutine\r\n    def get (self, account_id):\r\n        ...\r\n```\r\n\r\nAs a result of the above, the routes get mangled.  The above results in these routes:\r\n\r\n    \"/api/v1/accounts/profiles/?\",\r\n    \"<class 'handlers.api.v1.accounts.ProfileListHandler'>\"\r\n \r\n    \"/api/v1/accounts/profiles/?\",\r\n    \"<class 'handlers.api.v1.accounts.ProfileIdHandler'>\"\r\n  \r\n    \"/api/v1/accounts/profiles/(?P<account_id>[a-zA-Z0-9_]+)/?$\",\r\n    \"<class 'handlers.api.v1.accounts.ProfileIdHandler'>\"\r\n\r\nFor some reason, the ProfileIdHandler class gets returned as a route to both /profiles/ and /profiles/{}.  This doesn't happen if @gen.coroutine is removed.  Unfortunately, if I put @gen.coroutine above the @schema.validate, the coroutine does not work at all.  Also, please note that I have a PUT method in ProfileIdHandler (though it isn't shown in the example), and it is also getting doubled into both /profiles and /profiles/{}.  I'd love help resolving this issue as it is a blocker for me right now."},"comment":{"url":"https://api.github.com/repos/hfaran/Tornado-JSON/issues/comments/77017100","html_url":"https://github.com/hfaran/Tornado-JSON/issues/59#issuecomment-77017100","issue_url":"https://api.github.com/repos/hfaran/Tornado-JSON/issues/59","id":77017100,"user":{"login":"hfaran","id":2450496,"avatar_url":"https://avatars.githubusercontent.com/u/2450496?v=3","gravatar_id":"","url":"https://api.github.com/users/hfaran","html_url":"https://github.com/hfaran","followers_url":"https://api.github.com/users/hfaran/followers","following_url":"https://api.github.com/users/hfaran/following{/other_user}","gists_url":"https://api.github.com/users/hfaran/gists{/gist_id}","starred_url":"https://api.github.com/users/hfaran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hfaran/subscriptions","organizations_url":"https://api.github.com/users/hfaran/orgs","repos_url":"https://api.github.com/users/hfaran/repos","events_url":"https://api.github.com/users/hfaran/events{/privacy}","received_events_url":"https://api.github.com/users/hfaran/received_events","type":"User","site_admin":false},"created_at":"2015-03-03T19:33:37Z","updated_at":"2015-03-03T19:33:37Z","body":"It's great that it's working!\r\n\r\nHmm, are you using the exact same codebase (for your app) between v1.1.0 and this fix? Or is the performance difference after using `coroutine`s with the new fix and having the old one be synchronous?\r\nI do not think using `sys.path.append` should matter, but you can install the checked out version with `python setup.py install` to make certain.\r\n\r\nIf you could give me any more details regarding the performance test, it would be greatly appreciated. :)"}}