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) ))
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')
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)))