This commit is contained in:
Aevann1 2021-07-25 04:10:02 +02:00
parent 742cedb348
commit cefd63908a
5 changed files with 3 additions and 19 deletions

View file

@ -4,7 +4,6 @@ from .boards import *
from .board_relationships import * from .board_relationships import *
from .clients import * from .clients import *
from .comment import * from .comment import *
from .custom_errors import *
from .domains import Domain from .domains import Domain
from .flags import * from .flags import *
from .user 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 @auth_required
def banawardcomment(comment_id, v): 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() comment = g.db.query(Comment).filter_by(id=comment_id).first()
if not comment: abort(400) if not comment: abort(400)

View file

@ -2,12 +2,10 @@ import jinja2.exceptions
from drama.helpers.wrappers import * from drama.helpers.wrappers import *
from drama.helpers.session import * from drama.helpers.session import *
from drama.classes.custom_errors import *
from flask import * from flask import *
from urllib.parse import quote, urlencode from urllib.parse import quote, urlencode
import time import time
from drama.__main__ import app, r, cache, db_session from drama.__main__ import app
import gevent
# Errors # Errors
@ -27,14 +25,6 @@ def error_401(e):
else: else:
return redirect(output) 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) @app.errorhandler(403)
@auth_desired @auth_desired
@api() @api()

View file

@ -49,7 +49,7 @@ def resize():
@auth_required @auth_required
def postbanaward(post_id, v): 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() post = g.db.query(Submission).filter_by(id=post_id).first()
if not post: abort(400) if not post: abort(400)