def post(self): ret = self.check_privilege(TP_PRIVILEGE_OPS_AUZ) if ret != TPE_OK: return args = self.get_argument('args', None) if args is None: return self.write_json(TPE_PARAM) try: args = json.loads(args) except: return self.write_json(TPE_JSON_FORMAT) try: args['id'] = int(args['id']) args['name'] = args['name'].strip() args['desc'] = args['desc'].strip() except: log.e('\n') return self.write_json(TPE_PARAM) if len(args['name']) == 0: return self.write_json(TPE_PARAM) if args['id'] == -1: err, info = ops.create_policy(self, args) else: err = ops.update_policy(self, args) info = {} self.write_json(err, data=info)