コード例 #1
0
def calendar_event(slug, stamp):
    from metaforcefeed.utils import _get_event_str
    event = g.db.get(_get_event_str(slug, stamp))

    if not event:
        return abort(404)

    if request.method == 'POST':
        from metaforcefeed.utils import post_comment_to_event
        if not session.get('username', None):
            return redirect(url_for('metaforcefeed.login'))

        username = session['username']
        created, err = post_comment_to_event(g.db, slug, stamp,
                                             request.form['comment'], username)

        if not created:
            extra = err
        else:
            event = g.db.get(_get_event_str(slug, stamp))
            action_str = 'Commented on "{}, {}".'.format(stamp, slug)
            log_action(g.db, action_str)
        event = g.db.get(_get_event_str(slug, stamp))

    try:
        acks = [x["username"] for x in event["ACKs"]]
    except:
        acks = []

    try:
        deacks = [y["username"] for y in event["DEACKs"]]
    except:
        deacks = []

    all_users_involved = set(acks + deacks)

    return render_template("calendar_event.html",
                           event=event,
                           acks=acks,
                           deacks=deacks,
                           all_users_involved=all_users_involved)
コード例 #2
0
ファイル: routes.py プロジェクト: dequis/metaforcefeed
def calendar_event(slug, stamp):
    from metaforcefeed.utils import _get_event_str
    event = g.db.get(_get_event_str(slug, stamp))

    if not event:
        return abort(404)

    if request.method == 'POST':
        from metaforcefeed.utils import post_comment_to_event
        if not session.get('username', None):
            return redirect(url_for('metaforcefeed.login'))

        username = session['username']
        created, err = post_comment_to_event(g.db, slug, stamp, request.form['comment'], username)

        if not created:
            extra = err
        else:
            event = g.db.get(_get_event_str(slug, stamp))
            action_str = 'Commented on "{}, {}".'.format(stamp, slug)
            log_action(g.db, action_str)
        event = g.db.get(_get_event_str(slug, stamp))

    return render_template("calendar_event.html", event=event)
コード例 #3
0
ファイル: routes.py プロジェクト: qpfiffer/metaforcefeed
def calendar_event(slug, stamp):
    from metaforcefeed.utils import _get_event_str
    event = g.db.get(_get_event_str(slug, stamp))

    if not event:
        return abort(404)

    if request.method == 'POST':
        from metaforcefeed.utils import post_comment_to_event
        if not session.get('username', None):
            return redirect(url_for('metaforcefeed.login'))

        username = session['username']
        created, err = post_comment_to_event(g.db, slug, stamp, request.form['comment'], username)

        if not created:
            extra = err
        else:
            event = g.db.get(_get_event_str(slug, stamp))
            action_str = 'Commented on "{}, {}".'.format(stamp, slug)
            log_action(g.db, action_str)
        event = g.db.get(_get_event_str(slug, stamp))

    try:
        acks = [x["username"] for x in event["ACKs"]]
    except:
        acks = []

    try:
        deacks = [y["username"] for y in event["DEACKs"]]
    except:
        deacks = []

    all_users_involved = set(acks + deacks)

    return render_template("calendar_event.html", event=event, acks=acks, deacks=deacks, all_users_involved=all_users_involved)