On Jul 13, 2010, at 1:20 , Mike Burrows wrote:
> Why did you find it necessary to do "config['routes.map'] = map" at
> the end of make_map()? Is your config/environment.py (where this is
> normally done) the problem perhaps? Mike Orr alluded to this earlier
> when he mentioned load_environment().
I'm still trying to understand what I need to do here.
The standard TurboGears 2.1 environment.py is very short:
# -*- coding: utf-8 -*-
"""WSGI environment setup for example."""
from example.config.app_cfg import base_config
__all__ = ['load_environment']
#Use base_config to setup the environment loader function
load_environment = base_config.make_load_environment()
The change I made is to replace the last line with the below. This has gotten
the restful route working. I'd like to understand which part of the change is
responsible, and why:
def load_environment(global_conf, app_conf):
"""Configure the Pylons environment via the ``pylons.config``
object
"""
# Pylons paths
root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
paths = dict(root=root,
controllers=os.path.join(root, 'controllers'),
static_files=os.path.join(root, 'public'),
templates=[os.path.join(root, 'templates')])
# Initialize config with the basic options
config.init_app(global_conf, app_conf, package='eagle', paths=paths)
config['routes.map'] = make_map()
config['pylons.app_globals'] = app_globals.Globals()
config['pylons.h'] = eagle.lib.helpers
# Create the Mako TemplateLookup, with the default auto-escaping
config['pylons.app_globals'].mako_lookup = TemplateLookup(
directories=paths['templates'],
error_handler=handle_mako_error,
module_directory=os.path.join(app_conf['cache_dir'], 'templates'),
input_encoding='utf-8', default_filters=['escape'],
imports=['from webhelpers.html import escape'])
# Setup the SQLAlchemy database engine
engine = engine_from_config(config, 'sqlalchemy.')
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en.