Esempio n. 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)
Esempio n. 2
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
Esempio n. 3
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")
Esempio n. 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")
Esempio n. 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
Esempio n. 6
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)