示例#1
0
 def wapper(self):
     try:
         self.json_obj = json.loads(self.request.body)
         fuc(self)
     except Exception, e:
         fd_log.error("json decode error:%s,http body:%s", e,
                      self.request.body)
示例#2
0
文件: tools.py 项目: thm-tech/forward
def httpJSONArgsCheck(json_str, required_args, optional_args):
    for arg in required_args:
        if arg not in json_str:
            fd_log.error("Http JSON protocol is lack of required argument: %s!", arg)
            return False
    for arg in optional_args:
        if arg not in json_str:
            json_str[arg] = None
            # fd_log.warn("Http JSON protocol is lack of optional argument: %s.", arg)
    return True
示例#3
0
文件: tools.py 项目: thm-tech/forward
 def wapper(self):
     flag = True
     for argument in arguments:
         if argument not in self.json_obj:
             flag = False
             break
     if flag:
         fuc(self)
     else:
         fd_log.error("lack of arguments error")
         self.write("lack of arguments error")
示例#4
0
 def wapper(self):
     flag = True
     for argument in arguments:
         if argument not in self.json_obj:
             flag = False
             break
     if flag:
         fuc(self)
     else:
         fd_log.error("lack of arguments error")
         self.write("lack of arguments error")
示例#5
0
def httpJSONArgsCheck(json_str, required_args, optional_args):
    for arg in required_args:
        if arg not in json_str:
            fd_log.error(
                "Http JSON protocol is lack of required argument: %s!", arg)
            return False
    for arg in optional_args:
        if arg not in json_str:
            json_str[arg] = None
            # fd_log.warn("Http JSON protocol is lack of optional argument: %s.", arg)
    return True
示例#6
0
文件: tools.py 项目: thm-tech/forward
 def wapper(self):
     try:
         self.json_obj = json.loads(self.request.body)
         fuc(self)
     except Exception, e:
         fd_log.error("json decode error:%s,http body:%s", e, self.request.body)