@@ -0,0 +1,1391 @@
+# -*- coding: utf-8 -*-%0A#%0A# Copyright 2015 Zhang ZY%3Chttp://idupx.blogspot.com/%3E %0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22); you may%0A# not use this file except in compliance with the License. You may obtain%0A# a copy of the License at%0A#%0A#     http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless required by applicable law or agreed to in writing, software%0A# distributed under the License is distributed on an %22AS IS%22 BASIS, WITHOUT%0A# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the%0A# License for the specific language governing permissions and limitations%0A# under the License.%0A%0A%0Aimport functools%0Aimport logging%0A%0Afrom tornado import gen%0A%0Afrom twork.errors import BaseError%0A%0A%0Agen_logger = logging.getLogger('twork.general')%0A%0A%0Adef web_method_wrapper(func):%0A    @functools.wraps(func)%0A    @gen.coroutine%0A    def wrapper(self, *args, **kwargs):%0A        self.init_rsp_json()%0A%0A        try:%0A            yield func(self, *args, **kwargs)%0A        except BaseError as e:%0A            self.rsp_json%5B'code'%5D  = e.e_code%0A            self.rsp_json%5B'msg'%5D  = e.e_msg%0A%0A            self.api_response(self.rsp_json)%0A            gen_logger.error(e, exc_info=True)%0A        except StopIteration as e:%0A            raise e%0A        except Exception as e:%0A            self.api_response(self.rsp_json)%0A            gen_logger.error(e, exc_info=True)%0A%0A    return wrapper%0A

Add action_wrapper