Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
views: warn if handle_request returns dict
With this change a warnings.warn() is invoked when a handle_request returns a dict instead of a response objec. This warning is issued once for each unique file-name, line-number of the "offending" handle_request(s). The warning references the file and line number of the "offending" handle_request method and a link to the Response Objects documentation. The end-user can influence the result of the warning in the usual way by including the following lines: import warnings from lona.warnings import DictResponseDeprecationWarning warnings.simplefilter('always', DictResponseDeprecationWarning) causing the warning to issue every time (other options include 'error' and 'ignore') The warnings.warn mechanism is patched to be able to handle printing callee file-name and line-number (instead of the more usual caller info), in a similar way as the package ruamel.std.warnings.
- Loading branch information