Ejemplo n.º 1
0
def detailsThread(request):
    if request.method == "GET":
        requestData = getParam(request)
        requiredData = ["thread"]
        related = getRelated(requestData)
        try:
            tryParam(input=requestData, required=requiredData)
            threads = ThreadsHelper.detailsThreadHelper(id=requestData["thread"], related=related)
        except Exception as e:
            return generateError(e.message)
        return getResponse(threads)
    else:
        return HttpResponse(status=400)
Ejemplo n.º 2
0
def detailsPostHelper(id, option):
    post = postQueryHelper(id)
    if post is None:
        raise Exception("no post with id = "+id)

    if "user" in option:
        post["user"] = UsersHelper.detailsHelper(post["user"])
    if "forum" in option:
        post["forum"] = ForumsHelper.detailForumHelper(short_name=post["forum"], related=[])
    if "thread" in option:
        post["thread"] = ThreadsHelper.detailsThreadHelper(id=post["thread"], related=[])

    return post