Beispiel #1
0
 def post(self, *args, **kwargs):
     try:
         data = json.loads(self.request.body)
         channel = yield self.db.Channel.find_one({"_id": data["_id"]})
         if channel:
             c = Channel(_id=channel['_id'], body=data)
             channel = c.get()
         yield self.db.Channel.save(channel)
     except:
         self.write_response("", status=0)
         get_traceback()
Beispiel #2
0
 def post(self, *args, **kwargs):
     try:
         data = json.loads(self.request.body)     #将json格式文件变成字典
         c = Channel(data['_id'], body=data)
         channel = c.get()
         yield self.db.Channel.insert(channel)
         self.write_response("")
     except Exception as e:
         print e
         self.write_response("", status=0, error="channel 添加失败")
         get_traceback()