Latest Version: 0.9.6.2

configuration

Configuration setup for templating systems and Paste error middleware

This module supplies PylonsConfig which handles setting up defaults for templating systems, Paste errorware, and prefixing Routes if necessary.


Attributes

a config

{'buffet.template_options': {}, 'pylons.request_options': {'errors': 'replace', 'decode_param_names': False, 'charset': 'utf-8', 'language': 'en-us'}, 'pylons.paths': {'controllers': None, 'templates': [], 'static_files': None, 'root': None}, 'pylons.environ_config': {}, 'pylons.db_engines': {}, 'pylons.strict_c': False, 'pylons.h': None, 'pylons.package': None, 'debug': False, 'pylons.g': None, 'buffet.template_engines': [], 'pylons.response_options': {'headers': {'Pragma': 'no-cache', 'Cache-Control': 'no-cache'}, 'errors': 'strict', 'charset': 'utf-8', 'content_type': 'text/html'}}

a initial_config

{'buffet.template_engines': [],
 'buffet.template_options': {},
 'debug': False,
 'pylons.db_engines': {},
 'pylons.environ_config': {},
 'pylons.g': None,
 'pylons.h': None,
 'pylons.package': None,
 'pylons.paths': {'controllers': None,
                  'root': None,
                  'static_files': None,
                  'templates': []},
 'pylons.request_options': {'charset': 'utf-8',
                            'decode_param_names': False,
                            'errors': 'replace',
                            'language': 'en-us'},
 'pylons.response_options': {'charset': 'utf-8',
                             'content_type': 'text/html',
                             'errors': 'strict',
                             'headers': {'Cache-Control': 'no-cache',
                                         'Pragma': 'no-cache'}},
 'pylons.strict_c': False}

a log

<logging.Logger instance at 0x21a3e40>

a request_defaults

{'charset': 'utf-8',
 'decode_param_names': False,
 'errors': 'replace',
 'language': 'en-us'}

a response_defaults

{'charset': 'utf-8',
 'content_type': 'text/html',
 'errors': 'strict',
 'headers': {'Pragma': 'no-cache', 'Cache-Control': 'no-cache'}}

Classes

C PylonsConfig(...) ...

Pylons configuration object

The Pylons configuration object is a per-application instance object that retains the information regarding the global and app conf's as well as per-application instance specific data such as the mapper, the paths for this instance, and the myghty configuration.

The config object is available in your application as the Pylons global pylons.config. An example usage:

1
2
3
from pylons import config

template_paths = config['pylons.paths']['templates']

There's several useful keys of the config object most people will be interested in:

pylons.template_options
Full dict of template options that any TG compatible plugin should be able to parse. Comes with basic config needed for Myghty, Kid, and Mako.
pylons.paths
A dict of absolute paths that were defined in the applications config/environment.py module.
pylons.environ_config
Dict of environ keys for where in the environ to pickup various objects for registering with Pylons. If these are present then PylonsApp will use them from environ rather than using default middleware from Beaker. Valid keys are: session, cache
pylons.template_engines
List of template engines to configure. The first one in the list will be configured as the default template engine. Each item in the list is a dict indicating how to configure the template engine with keys: engine, template_root, template_options, and alias
pylons.default_charset
Deprecated: Use the response_settings dict instead. Default character encoding specified to the browser via the 'charset' parameter of the HTTP response's Content-Type header.
pylons.strict_c
Whether or not the c object should throw an attribute error when access is attempted to an attribute that doesn't exist.
pylons.request_options
A dict of Content-Type related default settings for new instances of paste.wsgiwrappers.WSGIRequest. May contain the values charset and errors and decode_param_names. Overrides the Pylons default values specified by the request_defaults dict.
pylons.response_options
A dict of Content-Type related default settings for new instances of pylons.Response. May contain the values content_type, charset and errors. Overrides the Pylons default values specified by the response_defaults dict.
routes.map
Mapper object used for Routing. Yes, it is possible to add routes after your application has started running.

This class contains 14 members.

See the source for more information.

Top