Ejemplo n.º 1
0
def send_activation(abo):
    try:
        url = url_external(url_for('abo.activate', key=abo.activation_code))
        message = ACTIVATION_MESSAGE % (abo.query, url)
        send_message(abo.email, u"Bestätigen Sie Ihr Themen-Abo", message)
    except Exception, e:
        log.exception(e)
Ejemplo n.º 2
0
def send_activation(abo):
    try:
        url = url_external(url_for('abo.activate', key=abo.activation_code))
        message = ACTIVATION_MESSAGE % (abo.query, url)
        send_message(abo.email, u"Bestätigen Sie Ihr Themen-Abo", message)
    except Exception, e:
        log.exception(e)
Ejemplo n.º 3
0
def notify_email(email):
    abos = db.session.query(Abo).filter_by(activation_code=None)
    abos = abos.filter_by(email=email).all()
    matching_abos = []
    activities = set()
    speeches = set()
    new_offset = datetime.utcnow()
    for abo in abos:
        before_len = len(activities) + len(speeches)
        if abo.include_activity:
            activities = activities.union(match_positions(abo))
        if abo.include_speeches:
            speeches = speeches.union(match_speeches(abo))
        if len(activities) + len(speeches) > before_len:
            matching_abos.append(abo)
            abo.offset = new_offset

    results = []
    if len(activities):
        results.append(u'\nABLÄUFE UND DRUCKSACHEN\n')
        results.extend(format_activities(activities))

    if len(speeches):
        results.append(u'\nDEBATTEN IM PLENUM\n')
        results.extend(format_speeches(speeches))

    if len(results):
        message = BASE_MESSAGE % ('\n'.join(results),
                                  format_matching_abos(matching_abos))
        send_message(email, u"Aktuelles im Parlament", message)
    db.session.commit()
Ejemplo n.º 4
0
def notify_email(email):
    abos = db.session.query(Abo).filter_by(activation_code=None)
    abos = abos.filter_by(email=email).all()
    matching_abos = []
    activities = set()
    speeches = set()
    new_offset = datetime.utcnow()
    for abo in abos:
        before_len = len(activities)+len(speeches)
        if abo.include_activity:
            activities = activities.union(match_positions(abo))
        if abo.include_speeches:
            speeches = speeches.union(match_speeches(abo))
        if len(activities)+len(speeches) > before_len:
            matching_abos.append(abo)
            abo.offset = new_offset
    
    results = []
    if len(activities):
        results.append(u'\nABLÄUFE UND DRUCKSACHEN\n')
        results.extend(format_activities(activities))

    if len(speeches):
        results.append(u'\nDEBATTEN IM PLENUM\n')
        results.extend(format_speeches(speeches))

    if len(results):
        message = BASE_MESSAGE % ('\n'.join(results), 
            format_matching_abos(matching_abos))
        send_message(email, 
            u"Aktuelles im Parlament",
            message)
    db.session.commit()