def del_reply(reply_id): reply = Reply.query.get_or_404(reply_id) reply.permissions.delete.test(403) reply.remove() if g.user.pk != reply.author.pk: body = render_template("emails/reply_deleted.html", reply=reply) sendmail(subject=_("Your reply has been deleted"), body=body, tos=[reply.author.email]) flash(_("The reply has been deleted"), "success") return redirect(url_for("gist.detail_gist", gist_id=reply.gist.pk))
def del_gist(gist_id): gist = Gist.query.get_or_404(gist_id) gist.permissions.delete.test(403) gist.remove() # maybe send mail if g.user.pk != gist.author.pk: body = render_template("emails/gist_deleted.html", gist=gist) sendmail(subject=_("Your gist has been deleted"), body=body, tos=[gist.author.email]) flash(_("The post has been deleted"), "success") next_url = request.args.get('next', url_for('home.index')) return redirect(next_url)