def show_item(item_id, edit=None): pd = PageData() if item_id is 'new': return redirect("/item/" + item_id + "/edit") try: showitem = SiteItem(item_id) if edit: showitem.old = True showitem.description = edit showitem.description_html = markdown.markdown( escape_html(str(showitem.body(edit))), md_extensions) except NoItem: return page_not_found(404) if 'username' in session: try: user = SiteUser.create(session['username']) pd.iteminfo = user.query_collection(showitem.uid) except (NoUser, NoItem): pass pd.title = showitem.name pd.item = showitem return render_template('item.html', pd=pd)
def revert_item_edit(item_id, edit): pd = PageData() try: item = SiteItem(item_id) item.old = True item.description = edit except NoItem: return page_not_found(404) pd.title = "Reverting: " + item.name pd.item_name = item.name pd.item = item return render_template('edititem.html', pd=pd)