Updated Frequently asked questions (markdown)

bdarnell 2012-12-02 18:47:31 -08:00
parent edcfd7cc78
commit de1c3c42a3
1 changed files with 5 additions and 1 deletions

@ -21,4 +21,8 @@ Just add a rule at the end of your handlers list that matches everything:
(r'.*', My404Handler) (r'.*', My404Handler)
In `My404Handler`, use `self.set_status(404)` and then render a page as usual. For non-404 errors, you can override `write_error` in your handler class. In `My404Handler`, use `self.set_status(404)` and then render a page as usual. For non-404 errors, you can override `write_error` in your handler class.
## Why don't tornado.escape.json_encode and json_decode pass unknown keyword arguments to the underlying implementation? OR Why don't json_encode and json_decode use [some faster json library] when available?
These two common requests are mutually exclusive - one ties json_encode more closely to a specific implementation, and the other requires the underlying implementation be swappable. In both cases I feel like the best approach is to leave tornado.escape.json_encode as a lowest-common-denominator json implementation that is available on all platforms where tornado runs. If you want more features that are provided by a specific json library, you should probably just import and use that library directly instead of using the tornado.escape version.