def details(): request_data = get_json(request) if 'related' not in request_data: request_data['related'] = None code, response = Thread.details(request_data['thread'], request_data['related']) return json.dumps( {'code': code, 'response': response} )
def details(post_id, related=None): if not related: related = [] code, result = Post.get_post(post_id) if code != Codes.OK: return code, result if code == Codes.OK and 'user' in related: code, result['user'] = User.details(result['user']) if code == Codes.OK and 'forum' in related: code, result['forum'] = Forum.details(result['forum']) if code == Codes.OK and 'thread' in related: code, result['thread'] = Thread.details(result['thread']) return code, result