def post(): try: paste = Paste.create(request.form, request.remote_addr) return redirect(url_for('view', key=paste.key)) except Invalid, inv: return htmlfill.render(index(), auto_insert_errors=False, defaults=request.form, errors=inv.unpack_errors())
def post(): form = dict(request.form) form.setdefault("force_header", False) form = ImmutableMultiDict(form) try: paste = Paste.create(form, request.remote_addr) return redirect(url_for('view', key=paste.key)) except Invalid, inv: return htmlfill.render(index(), auto_insert_errors=False, defaults=request.form, errors=inv.unpack_errors())
def get_paste(key, format): paste = Paste.by_key(key) if paste is None: raise NotFound('No such table: %s' % key) etag = generate_etag(key, format) if request.if_none_match and request.if_none_match == etag: raise NotModified() has_header, table = False, None try: has_header, table = parse(paste.format, paste.data) except ParseException, pe: log.exception(pe)