Пример #1
0
def fixture_comment_subscription(entry, notify=True, send_email=None):
    if send_email is None:
        uploader = User.query.filter_by(id=entry.uploader).first()
        send_email = uploader.wants_comment_notification

    cs = CommentSubscription(media_entry_id=entry.id,
                             user_id=entry.uploader,
                             notify=notify,
                             send_email=send_email)

    cs.save()

    cs = CommentSubscription.query.filter_by(id=cs.id).first()

    Session.expunge(cs)

    return cs
def fixture_comment_subscription(entry, notify=True, send_email=None):
    if send_email is None:
        uploader = User.query.filter_by(id=entry.uploader).first()
        send_email = uploader.wants_comment_notification

    cs = CommentSubscription(
        media_entry_id=entry.id,
        user_id=entry.uploader,
        notify=notify,
        send_email=send_email)

    cs.save()

    cs = CommentSubscription.query.filter_by(id=cs.id).first()

    Session.expunge(cs)

    return cs
Пример #3
0
def add_comment_subscription(user, media_entry):
    '''
    Create a comment subscription for a User on a MediaEntry.

    Uses the User's wants_comment_notification to set email notifications for
    the subscription to enabled/disabled.
    '''
    cn = get_comment_subscription(user.id, media_entry.id)

    if not cn:
        cn = CommentSubscription(user_id=user.id,
                                 media_entry_id=media_entry.id)

    cn.notify = True

    if not user.wants_comment_notification:
        cn.send_email = False

    cn.save()
def add_comment_subscription(user, media_entry):
    '''
    Create a comment subscription for a User on a MediaEntry.

    Uses the User's wants_comment_notification to set email notifications for
    the subscription to enabled/disabled.
    '''
    cn = get_comment_subscription(user.id, media_entry.id)

    if not cn:
        cn = CommentSubscription(
            user_id=user.id,
            media_entry_id=media_entry.id)

    cn.notify = True

    if not user.wants_comment_notification:
        cn.send_email = False

    cn.save()