def process_request(self, req): #TODO: catch errors if '/' + self.href == req.path_info: if 'GET' == req.method: self.return_json(req, Comments(req, self.env).search(req.args)) if 'POST' == req.method: comments = Comments(req, self.env) id = comments.create(json.loads(req.read())) self.return_json(req, comments.by_id(id))
def process_request(self, req): #TODO: catch errors if '/' + self.href == req.path_info: if 'GET' == req.method: # dirty fix for my Trac 1.0.1 with Postgres if req.args.get('revision') in ['null', '']: del req.args['revision'] self.return_json(req, Comments(req, self.env).search(req.args)) if 'POST' == req.method: comments = Comments(req, self.env) id = comments.create(json.loads(req.read())) self.return_json(req, comments.by_id(id))