Beispiel #1
0
def main():
    user = '******'
    password = getpass.getpass('enter password for {}: '.format(user))

    with get_connection(user, password) as c:
        for vhost in get_mail_vhosts():
            print('{vhost.domain} ({vhost.user}):'.format(vhost=vhost))
            print('=' * 50)

            for addr in vhost.get_forwarding_addresses(c):
                print('    {}'.format(addr))

            print()
def _txn(**kwargs):
    with get_connection(
            user=settings.OCFMAIL_USER,
            password=settings.OCFMAIL_PASSWORD,
            db=settings.OCFMAIL_DB,
            autocommit=False,
            **kwargs,
    ) as c:
        try:
            yield c
        except Exception:
            c.connection.rollback()
            raise
        else:
            c.connection.commit()
Beispiel #3
0
def _txn(**kwargs):
    with get_connection(
        user=settings.OCFMAIL_USER,
        password=settings.OCFMAIL_PASSWORD,
        db=settings.OCFMAIL_DB,
        autocommit=False,
        **kwargs
    ) as c:
        try:
            yield c
        except:
            c.connection.rollback()
            raise
        else:
            c.connection.commit()