Skip to content

Commit

Permalink
[svn] o config's pylons.map -> routes.map
Browse files Browse the repository at this point in the history
emphasizing routes isn't required to use Pylons
o add 'routes.' lookup to config's backwards compat. __getattr__

--HG--
branch : trunk
  • Loading branch information
pjenvey committed Jul 11, 2007
1 parent 1801757 commit 7269a20
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG
Expand Up @@ -33,7 +33,7 @@ Pylons Changelog
current action with self.errors set to the errors. Fixes #246.
* Added PylonsConfig, which gets accessed as pylons.config dict. Contains
all the merged ini options, in addition to the Config options such as
'pylons.map', 'pylons.paths', 'buffet.template_options', etc. Check the
'routes.map', 'pylons.paths', 'buffet.template_options', etc. Check the
pylons.config docs on PylonsConfig for dict keys populated by it.
* Split up resolution stages in wsgiapp, so that controller lookup is a
separate function making it easier to subclass. PylonsApp now takes a
Expand Down
2 changes: 1 addition & 1 deletion pylons/commands.py
Expand Up @@ -391,7 +391,7 @@ def command(self):
locs[name] = getattr(base, name)
locs.update(dict(wsgiapp=wsgiapp, app=test_app))

mapper = tresponse.pylons_config.get('pylons.map')
mapper = tresponse.pylons_config.get('routes.map')
if mapper:
locs['mapper'] = mapper
if has_models:
Expand Down
6 changes: 3 additions & 3 deletions pylons/configuration.py
Expand Up @@ -118,7 +118,7 @@ def __setattr__(this, name, value):

# Backwards compat for when the option is now in the dict, and
# access was attempted via attribute
for prefix in ('', 'pylons.', 'buffet.'):
for prefix in ('', 'pylons.', 'buffet.', 'routes.'):
full_name = prefix + name
if full_name in conf_dict:
warnings.warn(pylons.legacy.config_attr_moved % \
Expand Down Expand Up @@ -147,7 +147,7 @@ def load_environment(self, tmpl_options=None, map=None, paths=None,
if response_settings:
conf['pylons.response_options'].update(response_settings)

conf['pylons.map'] = map
conf['routes.map'] = map
conf['pylons.paths'] = paths or {}
conf['pylons.environ_config'] = environ_config or {}
conf['pylons.strict_c'] = strict_c
Expand Down Expand Up @@ -287,7 +287,7 @@ def set_defaults(self, template_engine):
if prefix:
warnings.warn(pylons.legacy.prefix_warning % prefix,
DeprecationWarning, 3)
map = conf.get('pylons.map')
map = conf.get('routes.map')
if map:
map.prefix = prefix
map._created_regs = False
Expand Down
11 changes: 7 additions & 4 deletions pylons/legacy.py
Expand Up @@ -25,10 +25,13 @@
And in in the load_environment function:
config['pylons.map'] = map
config['routes.map'] = map
config['buffet.template_options'] = tmpl_options
# etc.
# The template options
tmpl_options = config['buffet.template_options']
# CONFIGURATION OPTIONS HERE (note: all config options will override any
# Pylons config options)
See the default config/environment.py created via the "paster create -t pylons"
command for a full example.
Expand Down Expand Up @@ -78,9 +81,9 @@ def __init__(self):
config.init_app(global_conf, app_conf, package='%(package)s',
template_engine='%(template_engine)s', paths=paths)
config['pylons.map'] = make_map()
config['pylons.g'] = app_globals.Globals()
config['pylons.h'] = %(package)s.lib.helpers
config['routes.map'] = make_map()
See the default config/environment.py created via the "paster create -t pylons"
command for a full example.
Expand Down
Expand Up @@ -20,11 +20,11 @@ def load_environment(global_conf, app_conf):
config.init_app(global_conf, app_conf, package='${package}',
template_engine='${template_engine}', paths=paths)

config['pylons.map'] = make_map()
config['pylons.g'] = app_globals.Globals()
config['pylons.h'] = ${package}.lib.helpers
config['routes.map'] = make_map()

# Load-up the template options
# The template options
tmpl_options = config['buffet.template_options']

# CONFIGURATION OPTIONS HERE (note: all config options will override any
Expand Down
2 changes: 1 addition & 1 deletion pylons/wsgiapp.py
Expand Up @@ -266,7 +266,7 @@ def __init__(self, config=None, helpers=None, g=None,
base_app = base_wsgi_app or PylonsBaseWSGIApp
app = base_app(config, g, helpers=helpers)
if use_routes:
app = RoutesMiddleware(app, config['pylons.map'])
app = RoutesMiddleware(app, config['routes.map'])

# Pull user-specified environ overrides, or just setup default
# session and caching objects
Expand Down

0 comments on commit 7269a20

Please sign in to comment.