More debugging commands.

This commit is contained in:
Edward Betts 2018-06-04 07:42:54 +01:00
parent aa3b42c918
commit 2f5c4d7e79

View file

@ -1,4 +1,5 @@
from . import create_app, model, database
from pprint import pprint
import click
app = create_app('config.default')
@ -11,3 +12,25 @@ def reset_password(user_or_email, password):
user.set_password(password)
database.session.commit()
print(f'password updated for {user.username} ({user.email})')
@app.cli.command()
@click.argument('hashid')
def parse_link(hashid):
home = 'http://localhost:5000/'
item = model.Item.get_by_hashid(hashid)
pprint(item.parse())
print(item.item_and_title(home))
@app.cli.command()
def all_titles():
home = 'http://localhost:5000/'
titles = model.XanaLink.get_all_titles(home=home)
print(titles.values())
@app.cli.command()
@click.argument('hashid')
def delete_item(hashid):
item = model.Item.get_by_hashid(hashid)
database.session.delete(item)
database.session.commit()