I believe the proper syntax is:
@error(404)
def error404(error):
return "Nothing here, sorry: %s" % error.output
Post by Daniel WatrousIn bottle.py, ERROR_PAGE_TEMPLATE is defined and used as default for all
errors.
This can be easily overridden
return 'Nothing here, sorry'
The problem with this is that I can't figure out how to include the
message provided when I called abort. It will simply always print "Nothing
here, sorry"
It will also have a content type of text/html
I'm interested in having the flexibility to return a JSON document.
Daniel
Post by Daniel WatrousI'm using abort when to return non-successful status to clients. I would
like to override the default HTML output that is generated and instead have
it produce JSON.
Is this possible? How would I go about doing this?
--
--
You are member of the "bottlepy" group at google groups.
See http://groups.google.de/group/bottlepy for mailing list options.
See http://bottlepy.org/ for news and documentation.
---
You received this message because you are subscribed to the Google Groups "bottlepy" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/groups/opt_out.
--
This email is intended for the use of the individual addressee(s) named
above and may contain information that is confidential, privileged or
unsuitable for overly sensitive persons with low self-esteem, no sense of
humor or irrational religious beliefs. If you are not the intended
recipient, any dissemination, distribution or copying of this email is not
authorized (either explicitly or implicitly) and constitutes an irritating
social faux pas. Unless the word absquatulation has been used in its
correct context somewhere other than in this warning, it does not have any
legal or grammatical use and may be ignored. No animals were harmed in the
transmission of this email, although the yorkshire terrier next door is
living on borrowed time, let me tell you. Those of you with an overwhelming
fear of the unknown will be gratified to learn that there is no hidden
message revealed by reading this warning backwards, so just ignore that
Alert Notice from Microsoft: However, by pouring a complete circle of salt
around yourself and your computer you can ensure that no harm befalls you
and your pets. If you have received this email in error, please add some
nutmeg and egg whites and place it in a warm oven for 40 minutes. Whisk
briefly and let it stand for 2 hours before icing.
--
--
You are member of the "bottlepy" group at google groups.
See http://groups.google.de/group/bottlepy for mailing list options.
See http://bottlepy.org/ for news and documentation.
---
You received this message because you are subscribed to the Google Groups "bottlepy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bottlepy+***@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.