Martin Frlin
2015-10-15 13:46:25 UTC
I want to return simple json responses from error handlers, so my code is
somehting like this:
@app.error(401)
@app.error(404)
def error_handler(error):
return {'msg': error.body}
But this does not work as it returns nothing at all.
auto json feature does not work in error handlers?
Oh, and if anyone could explain why documentation says I need to import
error from bottle and then use it like @error(404)? error is an instance
method on Bottle class so I don't know how would it get "self" imported and
used like in documentation.
--
somehting like this:
@app.error(401)
@app.error(404)
def error_handler(error):
return {'msg': error.body}
But this does not work as it returns nothing at all.
auto json feature does not work in error handlers?
Oh, and if anyone could explain why documentation says I need to import
error from bottle and then use it like @error(404)? error is an instance
method on Bottle class so I don't know how would it get "self" imported and
used like in documentation.
--
--
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/d/optout.
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/d/optout.