Exemplo n.º 1
0
def isubscriptions():
    """Return an iterator of subscription information."""
    keys_iter = db.ikeys('email_sub')
    while True:
        key = keys_iter.next()
        if key is not None:
            sub = db.get(key)
            if sub is not None:
                yield key.split('email_sub:')[1], sub
Exemplo n.º 2
0
def delta_report_last_read(domain):
    """Retrieve the "last-read" date for delta report."""
    last_read = db.get('delta_report_read:{}'.format(domain))
    if last_read is not None:
        return datetime.datetime.strptime(last_read, '%Y-%m-%dT%H:%M:%SZ')
Exemplo n.º 3
0
def delta_report_updated(domain):
    """Retrieve when a delta report was last updated, or None."""
    updated = db.get('delta_report_updated:{}'.format(domain))
    if updated is not None:
        return datetime.datetime.strptime(updated, '%Y-%m-%dT%H:%M:%SZ')
Exemplo n.º 4
0
def get_delta_report(domain):
    """Retrieve the delta report for a domain, or None."""
    return db.get('delta_report:{}'.format(domain))
Exemplo n.º 5
0
def get_resolution_report(domain):
    """Retrieve the resolution report for a domain, or None."""
    return db.get('resolution_report:{}'.format(domain))
Exemplo n.º 6
0
def is_domain_registered(domain):
    """Return whether a domain is registered for reporting."""
    return db.get('registered_for_reporting:{}'.format(domain)) == True
Exemplo n.º 7
0
def email_last_send_for_sub(sub_id):
    """Return when an email was last sent for a subscription, or None."""
    last_sent = db.get('email_sub_last_sent:{}'.format(sub_id))
    if last_sent is not None:
        return datetime.datetime.strptime(last_sent, '%Y-%m-%dT%H:%M:%SZ')
Exemplo n.º 8
0
def get_proposition(verify_code):
    """Retrieve the proposition for a verify code (or None)."""
    return db.get('email_sub_pending:{}'.format(verify_code))