Esempio 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)
Esempio n. 2
0
def detailForum(request):
    if request.method == "GET":
        requestData = getParam(request)
        requiredData = ["forum"]
        related = getRelated(requestData)
        try:
            tryParam(input=requestData, required=requiredData)
            forums = ForumsHelper.detailForumHelper(short_name=requestData["forum"], related=related)
        except Exception as e:
            return generateError(e.message)
        return getResponse(forums)
    else:
        return HttpResponse(status=400)
Esempio n. 3
0
def detailsPost(request):
    if request.method == "GET":

        requestData = getParam(request)
        requiredData = ["post"]
        relating = getRelated(requestData)
        try:
            tryParam(input=requestData, required=requiredData)
            posts = PostHelpers.detailsPostHelper(requestData["post"], option=relating)
        except Exception as e:
            return generateError(e.message)
        return getResponse(posts)
    else:
        return HttpResponse(status=400)
Esempio n. 4
0
def listPostsForum(request):
    if request.method == "GET":
        requestData = getParam(request)
        requiredData = ["forum"]
        related = getRelated(requestData)
        optional = getOptional(request=requestData, values=["limit", "order", "since"])
        try:
            tryParam(input=requestData, required=requiredData)
            arrayPosts = PostHelpers.postListHelper(table="forum", id=requestData["forum"],
                                       related=related, option=optional)
        except Exception as e:
            return generateError(e.message)
        return getResponse(arrayPosts)
    else:
        return HttpResponse(status=400)
Esempio n. 5
0
def listThreadsForum(request):
    if request.method == "GET":
        required = ["forum"]
        request = getParam(request)
        related = getRelated(request)
        optional = getOptional(request=request, values=["limit", "order", "since"])
        try:
            tryParam(input=request, required=required)
            arrayThreads = ThreadsHelper.listThreadHelper(table="forum", id=request["forum"],
                                             related=related, params=optional)
        except Exception as e:
            return generateError(e.message)
        return getResponse(arrayThreads)
    else:
        return HttpResponse(status=400)