def got_post(postdoc, error): if error: self.result(xmlrpclib.Fault(500, str(error))) elif not postdoc: self.result(xmlrpclib.Fault(404, "Not found")) else: post = Post(**postdoc) self.result(post.to_metaweblog(self.application))
def got_post(postdoc, error): if error: raise error if not postdoc: self.result(xmlrpclib.Fault(404, "Not found")) else: post = Post(**postdoc) self.result(post.to_metaweblog(self.application))
def _get_post(self, postid): postdoc = yield self.settings['db'].posts.find_one(ObjectId(postid)) if not postdoc: self.result(xmlrpclib.Fault(404, "Not found")) else: post = Post(**postdoc) self.result(post.to_metaweblog(self.application))