cherrypy._cpchecker module

Checker for CherryPy sites and mounted apps.

class cherrypy._cpchecker.Checker[source]

Bases: object

A checker for CherryPy sites and their mounted applications.

When this object is called at engine startup, it executes each of its own methods whose names start with check_. If you wish to disable selected checks, simply add a line in your global config which sets the appropriate method to False:

[global]
checker.check_skipped_app_config = False

You may also dynamically add or replace check_* methods in this way.

_compat(config)[source]

Process config and warn on each obsolete or deprecated entry.

_known_ns(app)[source]
_known_types(config)[source]
_populate_known_types()[source]
check_app_config_brackets()[source]

Check for App config with extraneous brackets in section names.

check_app_config_entries_dont_start_with_script_name()[source]

Check for App config with sections that repeat script_name.

check_compatibility()[source]

Process config and warn on each obsolete or deprecated entry.

check_config_namespaces()[source]

Process config and warn on each unknown config namespace.

check_config_types()[source]

Assert that config values are of the same type as default values.

check_localhost()[source]

Warn if any socket_host is ‘localhost’. See #711.

check_site_config_entries_in_app_config()[source]

Check for mounted Applications that have site-scoped config.

check_skipped_app_config()[source]

Check for mounted Applications that have no config.

check_static_paths()[source]

Check Application config for incorrect static paths.

deprecated = {}
extra_config_namespaces = []
formatwarning(message, category, filename, lineno, line=None)[source]

Format a warning.

global_config_contained_paths = False
known_config_types = {'engine.__class__': <class 'type'>, 'engine.__dict__': <class 'dict'>, 'engine.__doc__': <class 'str'>, 'engine.__module__': <class 'str'>, 'engine._priorities': <class 'dict'>, 'engine.events': <class 'dict'>, 'engine.execv': <class 'bool'>, 'engine.listeners': <class 'dict'>, 'engine.max_cloexec_files': <class 'int'>, 'log.__class__': <class 'type'>, 'log.__dict__': <class 'dict'>, 'log.__doc__': <class 'str'>, 'log.__module__': <class 'str'>, 'log.access_file': <class 'str'>, 'log.access_log_format': <class 'str'>, 'log.error_file': <class 'str'>, 'log.logger_root': <class 'str'>, 'log.screen': <class 'bool'>, 'log.wsgi': <class 'bool'>, 'request.__attrname__': <class 'str'>, 'request.__class__': <class 'type'>, 'request.__dict__': <class 'dict'>, 'request.__module__': <class 'str'>, 'request.__slots__': <class 'list'>, 'request.base': <class 'str'>, 'request.closed': <class 'bool'>, 'request.error_page': <class 'dict'>, 'request.header_list': <class 'list'>, 'request.method': <class 'str'>, 'request.methods_with_bodies': <class 'tuple'>, 'request.params': <class 'dict'>, 'request.path_info': <class 'str'>, 'request.process_request_body': <class 'bool'>, 'request.protocol': <class 'tuple'>, 'request.query_string': <class 'str'>, 'request.query_string_encoding': <class 'str'>, 'request.request_line': <class 'str'>, 'request.scheme': <class 'str'>, 'request.script_name': <class 'str'>, 'request.server_protocol': <class 'str'>, 'request.show_mismatched_params': <class 'bool'>, 'request.show_tracebacks': <class 'bool'>, 'request.throw_errors': <class 'bool'>, 'request.throws': <class 'tuple'>, 'request.toolmaps': <class 'dict'>, 'response.__attrname__': <class 'str'>, 'response.__class__': <class 'type'>, 'response.__dict__': <class 'dict'>, 'response.__module__': <class 'str'>, 'response.__slots__': <class 'list'>, 'response._body': <class 'list'>, 'response.body': <class 'list'>, 'response.stream': <class 'bool'>, 'response.time': <class 'float'>, 'server.__class__': <class 'type'>, 'server.__dict__': <class 'dict'>, 'server.__doc__': <class 'str'>, 'server.__module__': <class 'str'>, 'server._socket_host': <class 'str'>, 'server.accepted_queue_size': <class 'int'>, 'server.accepted_queue_timeout': <class 'int'>, 'server.bind_addr': <class 'tuple'>, 'server.bound_addr': <class 'tuple'>, 'server.description': <class 'str'>, 'server.max_request_body_size': <class 'int'>, 'server.max_request_header_size': <class 'int'>, 'server.nodelay': <class 'bool'>, 'server.peercreds': <class 'bool'>, 'server.peercreds_resolve': <class 'bool'>, 'server.protocol_version': <class 'str'>, 'server.running': <class 'bool'>, 'server.shutdown_timeout': <class 'int'>, 'server.socket_host': <class 'str'>, 'server.socket_port': <class 'int'>, 'server.socket_queue_size': <class 'int'>, 'server.socket_timeout': <class 'int'>, 'server.ssl_module': <class 'str'>, 'server.statistics': <class 'bool'>, 'server.thread_pool': <class 'int'>, 'server.thread_pool_max': <class 'int'>, 'server.wsgi_version': <class 'tuple'>}
obsolete = {'log_access_file': 'log.access_file', 'log_config_options': None, 'log_file': 'log.error_file', 'log_file_not_found': None, 'log_request_headers': 'tools.log_headers.on', 'log_to_screen': 'log.screen', 'profiler.on': 'cherrypy.tree.mount(profiler.make_app(cherrypy.Application(Root())))', 'server.default_content_type': 'tools.response_headers.headers', 'show_tracebacks': 'request.show_tracebacks', 'throw_errors': 'request.throw_errors'}
on = True

If True (the default), run all checks; if False, turn off all checks.