def edit_posted_resp(response_id): form = EditForm(request.form) if request.method == 'POST' and form.validate(): response = session.query(Response).get(response_id) form.populate_obj(response) response.cleaned_html = clean_html_email(response.raw_html) session.add(response) session.commit() return redirect("/r/%s" % response_id) else: response = session.query(Response).get(response_id) account = response.account response.raw_html = response.cleaned_html form = EditForm(obj=response) return render_template('edit_post.jinja2.html', response=response, account=account, form=form,)
def debug(): print "="*120 print "Recieving message" print request.headers lst = request.form.items() dct = {} for k,v in lst: dct[k] = v everything = json.dumps(dct) _from = dct['From'] to = dct['To'] subject = dct['Subject'] cleaned_h = clean_html_email(dct['body-html']) name, f_e = pull_out_name_email(_from) account = session.query(Account).get(f_e) resp = Response(from_email=f_e, to_email=to, subject=subject, body_plain=dct['body-plain'], cleaned_html=cleaned_h, everything=everything,) session.add(resp) session.commit() respond_confirming_post(resp, account) return "yes"