~homeworkprod/byceps

670f5bcf4acacd9401001f733cba4b9df208ea0d — Jochen Kupperschmidt 2 years ago c4acae9
Show 404 if no party is configured for site on party and ticketing pages
2 files changed, 10 insertions(+), 2 deletions(-)

M byceps/blueprints/party/views.py
M byceps/blueprints/ticketing/views.py
M byceps/blueprints/party/views.py => byceps/blueprints/party/views.py +5 -1
@@ 6,7 6,7 @@ byceps.blueprints.party.views
:License: Modified BSD, see LICENSE for details.
"""

from flask import g
from flask import abort, g

from ...services.party import service as party_service
from ...services.ticketing import attendance_service


@@ 21,6 21,10 @@ blueprint = create_blueprint('party', __name__)
@templated
def info():
    """Show information about the current party."""
    if g.party_id is None:
        # No party is configured for the current site.
        abort(404)

    party = party_service.get_party(g.party_id)

    return {

M byceps/blueprints/ticketing/views.py => byceps/blueprints/ticketing/views.py +5 -1
@@ 33,10 33,14 @@ blueprint = create_blueprint('ticketing', __name__)
@templated
def index_mine():
    """List tickets related to the current user."""
    current_user = g.current_user
    if g.party_id is None:
        # No party is configured for the current site.
        abort(404)

    party = party_service.get_party(g.party_id)

    current_user = g.current_user

    tickets = ticket_service.find_tickets_related_to_user_for_party(
        current_user.id, party.id)