Skip to content

Commit

Permalink
[svn] fixed various borkenness with the default_charset deprecation w…
Browse files Browse the repository at this point in the history
…arnings

--HG--
branch : trunk
  • Loading branch information
pjenvey committed Feb 15, 2007
1 parent 0375305 commit 07b1199
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
3 changes: 2 additions & 1 deletion pylons/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"""
import os
import re
import warnings

from paste.deploy.converters import asbool

Expand Down Expand Up @@ -105,7 +106,7 @@ def __init__(self, tmpl_options=None, map=None, paths=None,

if default_charset is not None:
warnings.warn(pylons.legacy.default_charset_warning % \
('Config', default_charset),
dict(klass='Config', charset=default_charset),
DeprecationWarning, 2)
self.response_settings['charset'] = default_charset

Expand Down
13 changes: 7 additions & 6 deletions pylons/legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@

import pylons

default_charset_warning = \
"The 'default_charset' keyword argument to the %s constructor is deprecated. "
"Please specify response_settings=dict(charset='%s') to the Config object in "
"your 'config/environment.py file instead, e.g.:\n"
"return pylons.config.Config(myghty, map, paths,"
" response_settings=dict(charset='%s'))"
default_charset_warning = (
"The 'default_charset' keyword argument to the %(klass)s constructor is "
"deprecated. Please specify response_settings=dict(charset='%(charset)s') to "
"""the Config constructor in your 'config/environment.py file instead, e.g.:\n
return pylons.config.Config(tmpl_options, map, paths,
response_settings=dict(charset='%(charset)s'))"
""")


def load_h(package_name):
Expand Down
4 changes: 2 additions & 2 deletions pylons/wsgiapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,9 @@ def __init__(self, config, default_charset=None, helpers=None, g=None,
self.config = config
if default_charset:
warnings.warn(pylons.legacy.default_charset_warning % \
('PylonsApp', default_charset),
dict(klass='PylonsApp', charset=default_charset),
DeprecationWarning, 2)
self.config.request_settings['charset'] = default_charset
self.config.response_settings['charset'] = default_charset

if helpers is None or g is None:
warnings.warn(
Expand Down

0 comments on commit 07b1199

Please sign in to comment.