|
|
@ -73,7 +73,7 @@ def get_recipes():
|
|
|
|
recipes.append(meta)
|
|
|
|
recipes.append(meta)
|
|
|
|
return recipes
|
|
|
|
return recipes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# post the recipe in the wiki
|
|
|
|
def update_wiki(recipe):
|
|
|
|
def update_wiki(recipe):
|
|
|
|
import mwclient
|
|
|
|
import mwclient
|
|
|
|
|
|
|
|
|
|
|
@ -85,7 +85,6 @@ def update_wiki(recipe):
|
|
|
|
page = site.pages['Week Six: Diffractive reading methods']
|
|
|
|
page = site.pages['Week Six: Diffractive reading methods']
|
|
|
|
|
|
|
|
|
|
|
|
text = page.text()
|
|
|
|
text = page.text()
|
|
|
|
|
|
|
|
|
|
|
|
steps = '\n'.join([f"# {log}" for log in recipe["logs"]])
|
|
|
|
steps = '\n'.join([f"# {log}" for log in recipe["logs"]])
|
|
|
|
|
|
|
|
|
|
|
|
# PROV TEMPLATE
|
|
|
|
# PROV TEMPLATE
|
|
|
@ -105,21 +104,11 @@ def update_wiki(recipe):
|
|
|
|
{recipe['who']}
|
|
|
|
{recipe['who']}
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
# mi disp
|
|
|
|
# delete multiline indentation
|
|
|
|
text += '\n'.join([line.strip() for line in content.splitlines()])
|
|
|
|
text += '\n'.join([line.strip() for line in content.splitlines()])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
page.edit(text, f'Added a new recipe! {recipe["title"]}')
|
|
|
|
page.edit(text, f'Added a new recipe! {recipe["title"]}')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# sample object to test the md output
|
|
|
|
|
|
|
|
r = {
|
|
|
|
|
|
|
|
"title": "Test test test",
|
|
|
|
|
|
|
|
"description": "A super simple description",
|
|
|
|
|
|
|
|
"logs": ["first step", "second step", "third step"],
|
|
|
|
|
|
|
|
"who": "a friend of mine",
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# TODO: get data from client
|
|
|
|
# TODO: get data from client
|
|
|
|
@app.route("/", methods=["GET", "POST"])
|
|
|
|
@app.route("/", methods=["GET", "POST"])
|
|
|
|