Example #1
0
def update_review_request(reqId):
    """
    Updates a review request by given user
    if the user is allowed to update.

        :reqId = id of article to update

    """
    req = ReviewRequestModel().get_request_review(reqId)
    form = ReviewRequest(request.form)
    if req and req["username"] == session.get('username'):
        if form.validate():
            ReviewRequestModel().insert_(form.data)
            # TODO not a string but response
            return "ok"
            #return redirect(url_for('respond_for_review',reqId=reqId))
    #logger.debug(form.errors)
    # TODO should return 404 and not form invalid
    return "form invalid %s " % form.errors
Example #2
0
def update_review_request(reqId):
    """
    Updates a review request by given user
    if the user is allowed to update.

        :reqId = id of article to update

    """
    req = ReviewRequestModel().get_request_review(reqId)
    form = ReviewRequest(request.form)
    if req and req["username"] == session.get('username'):
        if form.validate():
            ReviewRequestModel().insert_(form.data)
            # TODO not a string but response
            return "ok"
            #return redirect(url_for('respond_for_review',reqId=reqId))
    #logger.debug(form.errors)
    # TODO should return 404 and not form invalid
    return "form invalid %s " % form.errors
Example #3
0
def request_review():
    uid = escape(session["uid"])
    form = ReviewRequest(request.form)
    if request.method == "POST":
        if form.validate():
            if request.files.get('file'):
                message = handle_data(request.files["file"], form.data, uid)
                if message is None:
                    flash("New review request sucessfuly added")
                    return redirect(url_for("startpage", n=0))
                else:
                    # error message from handle_upload
                    flash(message,'error')
            else:
                # no file
                flash("No file added",'error')
        else:
            # invalid form
            flash('We detected some errors in your submission. Invalid form.','error')
    flash("Request review of your article, book, or anything you'd like.")
    return render_template("reviewRequest/post_request_review.html", form=form)
Example #4
0
def request_review():
    uid = escape(session["uid"])
    form = ReviewRequest(request.form)
    if request.method == "POST":
        if form.validate():
            if request.files.get('file'):
                message = handle_data(request.files["file"], form.data, uid)
                if message is None:
                    flash("New review request sucessfuly added")
                    return redirect(url_for("startpage", n=0))
                else:
                    # error message from handle_upload
                    flash(message, 'error')
            else:
                # no file
                flash("No file added", 'error')
        else:
            # invalid form
            flash('We detected some errors in your submission. Invalid form.',
                  'error')
    flash("Request review of your article, book, or anything you'd like.")
    return render_template("reviewRequest/post_request_review.html", form=form)
Example #5
0
def respond_for_review(reqId):
    """
    Displays one single review request
    redirects to template which contains form for review
    """
    loginForm = Login(request.form)
    form = ReviewThis(request.form)
    rev_req_form = ReviewRequest(request.form)
    item = ReviewRequestModel().get_request_review(reqId)
    if item:
        return render_template('reviewRequest/respond.html',
                               item=item,
                               form=form,
                               loginForm=loginForm,
                               revReq=rev_req_form)
    return render_template("Errorpage.html", loginForm=loginForm)