示例#1
0
def delete(bot, msg):
    """Delete a shorturl."""

    slug = msg.match.group(1)
    with shorturl_db(user='******', password=bot.mysql_password) as ctx:
        delete_shorturl(ctx, slug)
        msg.respond(f'shorturl `{slug}` has been deleted.')
示例#2
0
def delete_url(query=None):

    password = pass_extract()

    with shorturl_db(user='******', password=password) as ctx:
        try:
            delete_shorturl(ctx, query)
        except:
            return render_template('page.html', success='Error')
        else:
            return render_template('page.html', success='Deleted', search_results=[])

    return render_template('page.html', success='Error')