Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom environ variables should not be stringified in wsgihttpexception #239

Closed
mcdonc opened this issue Jul 16, 2011 · 0 comments
Closed

Comments

@mcdonc
Copy link
Member

mcdonc commented Jul 16, 2011

As reported by plantian:

Exception happened during processing of request from ('127.0.0.1', 54364)
Traceback (most recent call last):
  File "/home/ian/workspace/gardentheory/gardentheory/ve/lib/python2.7/site-packages/paste/httpserver.py", line 1068, in process_request_in_thread
    self.finish_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 323, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python2.7/SocketServer.py", line 639, in __init__
    self.handle()
  File "/home/ian/workspace/gardentheory/gardentheory/ve/lib/python2.7/site-packages/paste/httpserver.py", line 442, in handle
    BaseHTTPRequestHandler.handle(self)
  File "/usr/lib/python2.7/BaseHTTPServer.py", line 337, in handle
    self.handle_one_request()
  File "/home/ian/workspace/gardentheory/gardentheory/ve/lib/python2.7/site-packages/paste/httpserver.py", line 437, in handle_one_request
    self.wsgi_execute()
  File "/home/ian/workspace/gardentheory/gardentheory/ve/lib/python2.7/site-packages/paste/httpserver.py", line 289, in wsgi_execute
    for chunk in result:
  File "/home/ian/workspace/gardentheory/gardentheory/ve/lib/python2.7/site-packages/errormator_client.py", line 658, in __call__
    app_iter = self.app(environ, start_response)
  File "/home/ian/workspace/gardentheory/gardentheory/ve/lib/python2.7/site-packages/pyramid-1.1b1-py2.7.egg/pyramid/router.py", line 187, in __call__
    return response(request.environ, start_response)
  File "/home/ian/workspace/gardentheory/gardentheory/ve/lib/python2.7/site-packages/pyramid-1.1b1-py2.7.egg/pyramid/httpexceptions.py", line 264, in __call__
    self._set_default_attrs(environ)
  File "/home/ian/workspace/gardentheory/gardentheory/ve/lib/python2.7/site-packages/pyramid-1.1b1-py2.7.egg/pyramid/httpexceptions.py", line 239, in _set_default_attrs
    args[k] = escape(v)
  File "build/bdist.linux-x86_64/egg/webob/util.py", line 22, in html_escape
    s = str(s)
  File "/home/ian/workspace/gardentheory/gardentheory/gardentheory/gardentheory/model/user.py", line 78, in __str__
    return self.username
  File "/home/ian/workspace/gardentheory/gardentheory/ve/lib/python2.7/site-packages/sqlalchemy/orm/attributes.py", line 168, in __get__
    return self.impl.get(instance_state(instance),dict_)
  File "/home/ian/workspace/gardentheory/gardentheory/ve/lib/python2.7/site-packages/sqlalchemy/orm/attributes.py", line 418, in get
    value = callable_(passive)
  File "/home/ian/workspace/gardentheory/gardentheory/ve/lib/python2.7/site-packages/sqlalchemy/orm/state.py", line 275, in __call__
    self.manager.deferred_scalar_loader(self, toload)
  File "/home/ian/workspace/gardentheory/gardentheory/ve/lib/python2.7/site-packages/sqlalchemy/orm/mapper.py", line 2759, in _load_scalar_attributes
    (state_str(state)))
DetachedInstanceError: Instance <User at 0x3637bd0> is not bound to a Session; attribute refresh operation cannot proceed

The key in question here is "gardentheory.user"; we should not try to stringify this (or any other custom environ var) in _set_default_attrs.

@mcdonc mcdonc closed this as completed in 4b3ba9a Jul 16, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant