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