Beispiel #1
0
def get_person_category_or_None(meeting_id, person_category_id):
    try:
        category = Category.select().where(
            data__contains={'id': str(person_category_id)}
        ).join(CategoryMeeting).where(meeting_id=str(meeting_id)).get()
    except Category.DoesNotExist:
        category = None
    return category
Beispiel #2
0
def get_category_or_404(meeting_id, category_id):
    try:
        category = (Category.select().join(CategoryMeeting)
                            .where(meeting=meeting_id, category=category_id)
                            .get())
    except Category.DoesNotExist:
        flask.abort(404)
    return category
Beispiel #3
0
def get_person_category_or_404(meeting_id, person_id=None, category_id=None):
    if not category_id:
        try:
            category_id = PersonMeeting.select().where(meeting=meeting_id,
                person=person_id).get().category
        except PersonMeeting.DoesNotExist:
            flask.abort(404)

    try:
        category = Category.select().where(
            data__contains={'id': str(category_id)}
        ).join(CategoryMeeting).where(meeting_id=str(meeting_id)).get()
    except Category.DoesNotExist:
        flask.abort(404)

    return category