Esempio n. 1
0
def register_redirect(original, new_url):
    """Register a new redirect.  Also an old one that may still exist."""
    original = _strip_url(original)
    db.execute(redirects.delete(original=original))
    db.execute(redirects.insert(), dict(
        original=original,
        new=_strip_url(new_url)
    ))
Esempio n. 2
0
def unregister_redirect(url):
    """Unregister a redirect."""
    rv = db.execute(redirects.delete(redirects.c.original == _strip_url(url)))
    if not rv.rowcount:
        raise ValueError('no such URL')
Esempio n. 3
0
def register_redirect(original, new_url):
    """Register a new redirect.  Also an old one that may still exist."""
    original = _strip_url(original)
    db.execute(redirects.delete(original=original))
    db.execute(redirects.insert(),
               dict(original=original, new=_strip_url(new_url)))
Esempio n. 4
0
def unregister_redirect(url):
    """Unregister a redirect."""
    rv = db.execute(redirects.delete(redirects.c.original == _strip_url(url)))
    if not rv.rowcount:
        raise ValueError('no such URL')