Skip to content

Commit

Permalink
Use request defaults properly
Browse files Browse the repository at this point in the history
--HG--
branch : trunk
  • Loading branch information
bbangert committed Feb 20, 2009
1 parent 245a977 commit 0407e0a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 1 addition & 7 deletions pylons/controllers/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,7 @@ class Request(WebObRequest):
adds defaults, along with several methods for backwards
compatibility with paste.wsgiwrappers.WSGIRequest.
"""
charset = 'utf-8'
unicode_errors = 'replace'
language = 'en-us'

"""
def determine_browser_charset(self):
"""Legacy method to return the
:attr:`webob.Request.accept_charset`"""
Expand Down Expand Up @@ -93,8 +89,6 @@ class Response(WebObResponse):
backwards compatibility with paste.wsgiwrappers.WSGIResponse.
"""
default_content_type = 'text/html'
errors = 'strict'
content = WebObResponse.body

def determine_charset(self):
Expand Down
4 changes: 3 additions & 1 deletion pylons/testutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ def __call__(self, environ, start_response):
registry.register(pylons.translator, translator)

# Update the environ
req = Request(environ)
req = Request(environ, charset=request_defaults['charset'],
unicode_errors=request_defaults['errors'],
decode_param_names=request_defaults['decode_param_names'])
req.language = request_defaults['language']

response = Response(
Expand Down
8 changes: 6 additions & 2 deletions pylons/wsgiapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,13 @@ def setup_app_env(self, environ, start_response):
if self.log_debug:
log.debug("Setting up Pylons stacked object globals")


# Setup the basic pylons global objects
req = Request(environ)
req.language = self.request_options['language']
req_options = self.request_options
req = Request(environ, charset=req_options['charset'],
unicode_errors=req_options['errors'],
decode_param_names=req_options['decode_param_names'])
req.language = req_options['language']

response = Response(
content_type=self.response_options['content_type'],
Expand Down

0 comments on commit 0407e0a

Please sign in to comment.