def update(self,req,body,id=None): environ = req.environ user_id = environ['HTTP_X_USER_ID'] user_name = environ['HTTP_X_USER_NAME'] user_role = environ['HTTP_X_ROLES'] self.db_session=environ['db_session'] #修改sv_arg_type_tb表 input_arg_types=body.pop('input_arg_types') for key in input_arg_types.keys(): db.updateSvArgtype(self.db_session,key,input_arg_types['key']) output_arg_types=body.pop('output_arg_types') for key in output_arg_types.keys(): db.updateSvArgtype(self.db_session, key, input_arg_types['key']) #修改sv_tb表 db.updateSvTB(self.db_session, id, body)
def update(self, req, body, id=None): environ = req.environ user_id = environ['HTTP_X_USER_ID'] user_name = environ['HTTP_X_USER_NAME'] user_role = environ['HTTP_X_ROLES'] self.db_session = environ['db_session'] #修改sv_arg_type_tb表 input_arg_types = body.pop('input_arg_types') for key in input_arg_types.keys(): db.updateSvArgtype(self.db_session, key, input_arg_types['key']) output_arg_types = body.pop('output_arg_types') for key in output_arg_types.keys(): db.updateSvArgtype(self.db_session, key, input_arg_types['key']) #修改sv_tb表 db.updateSvTB(self.db_session, id, body)
try: target=SvTarget.svtarget_factory(self.db_session,id).to_dict() except Exception,e: return e.message policy.init() try: policy.enforce(context, action, target) except Exception,e: return e.msg #修改sv_arg_type_tb表 print body print "#####################" print body['input_arg_types'] input_arg_types=body.pop('input_arg_types') for key in input_arg_types.keys(): db.updateSvArgtype(self.db_session,key,input_arg_types[key]) output_arg_types=body.pop('output_arg_types') for key in output_arg_types.keys(): db.updateSvArgtype(self.db_session, key, output_arg_types[key]) print "#####################" print body #修改sv_tb表 db.updateSvTB(self.db_session, id, body) return 'update successfully!!!' class ArgTypeMan(): def __init__(self): self.db_session=None def index(self,req): environ = req.environ