master
Aevann1 2021-07-25 04:10:02 +02:00
parent 3986b5c422
commit 70894280f8
5 changed files with 3 additions and 19 deletions

View File

@ -4,7 +4,6 @@ from .boards import *
from .board_relationships import *
from .clients import *
from .comment import *
from .custom_errors import *
from .domains import Domain
from .flags import *
from .user import *

View File

@ -1,5 +0,0 @@
class PaymentRequired(Exception):
status_code=402
def __init__(self):
Exception.__init__(self)
self.status_code=402

View File

@ -25,7 +25,7 @@ beams_client = PushNotifications(
@auth_required
def banawardcomment(comment_id, v):
if not v.banawards > 0: abort(402)
if not v.banawards > 0: return render_template("errors/402.html", v=v)
comment = g.db.query(Comment).filter_by(id=comment_id).first()
if not comment: abort(400)

View File

@ -2,12 +2,10 @@ import jinja2.exceptions
from drama.helpers.wrappers import *
from drama.helpers.session import *
from drama.classes.custom_errors import *
from flask import *
from urllib.parse import quote, urlencode
import time
from drama.__main__ import app, r, cache, db_session
import gevent
from drama.__main__ import app
# Errors
@ -27,14 +25,6 @@ def error_401(e):
else:
return redirect(output)
@app.errorhandler(402)
@auth_desired
@api()
def error_402(e, v):
return{"html": lambda: (render_template('errors/402.html', v=v), 402),
"api": lambda: (jsonify({"error": "402 Payment Required"}), 402)
}
@app.errorhandler(403)
@auth_desired
@api()

View File

@ -49,7 +49,7 @@ def resize():
@auth_required
def postbanaward(post_id, v):
if not v.banawards > 0: abort(402)
if not v.banawards > 0: return render_template("errors/402.html", v=v)
post = g.db.query(Submission).filter_by(id=post_id).first()
if not post: abort(400)