3 messages in com.googlegroups.pylons-discussRe: updating select box dynamically| From | Sent On | Attachments |
|---|---|---|
| Anil | 25 Dec 2006 10:42 | |
| Mike Orr | 26 Dec 2006 12:21 | |
| Shannon -jj Behrens | 27 Dec 2006 13:52 |
| Subject: | Re: updating select box dynamically![]() |
|---|---|
| From: | Mike Orr (slug...@public.gmane.org) |
| Date: | 12/26/2006 12:21:38 PM |
| List: | com.googlegroups.pylons-discuss |
On 12/25/06, Anil <repl...@public.gmane.org> wrote:
I receive some weird error when doing this...
<select name="users" id="users" style="width:158px;" multiple size=8> </select>
<% h.submit_to_remote('button', 'Create', update="someThing", complete=h.remote_function( update="users", url=h.url(controller='run', action='ok', id='users') ), url=h.url(controller='api', action='new', id='save') ) %>
controller=run, action=ok, id=users returns: <option value="cn=Anil">Anil</option><option value="cn=test">test</option>
However in the paster console I see this error message, what does it all mean?
----------------------------------------
Exception happened during processing of request from ('IP...', 2813)
Traceback (most recent call last):
File
"/home/anilj/lib/python2.4/site-packages/Paste-1.0-py2.4.egg/paste/httpserver.py",
line 405, in process_request_in_thread
self.finish_request(request, client_address)
File "/home/anilj/lib/python2.4/SocketServer.py", line 254, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/home/anilj/lib/python2.4/SocketServer.py", line 521, in __init__
self.handle()
File
"/home/anilj/lib/python2.4/site-packages/Paste-1.0-py2.4.egg/paste/httpserver.py",
line 326, in handle
BaseHTTPRequestHandler.handle(self)
File "/home/anilj/lib/python2.4/BaseHTTPServer.py", line 316, in handle
self.handle_one_request()
File "/home/anilj/lib/python2.4/BaseHTTPServer.py", line 310, in
handle_one_request
method()
File
"/home/anilj/lib/python2.4/site-packages/Paste-1.0-py2.4.egg/paste/httpserver.py",
line 232, in wsgi_execute
self.wsgi_write_chunk(chunk)
File
"/home/anilj/lib/python2.4/site-packages/Paste-1.0-py2.4.egg/paste/httpserver.py",
line 111, in wsgi_write_chunk
(status, headers) = self.wsgi_curr_headers
TypeError: unpack non-sequence
It means self.wsgi_curr_headers is not a tuple as expected. Most likely it got set to None for some reason. The first thing is to see what the actual value is by expanding the fancy traceback or adding a print statement before the line. Assiming it's None, the question is how did it get that way? .wsgi_curr_headers is assigned three times in httpserver.py and nowhere else:
- It's set to None at the end of WSGIHandlerMixin.wsgi_setup() -- line 210. - It's set to a 500 error in .wsgi_execute(). Not applicable. - It's set to a tuple at the end of .wsgi_start_response() -- line 150.
So one assumes line 150 was *not* executed before line 111, though it should have been.
Did the app or middleware not call the start_response() callback? Did some strange value somewhere cause a buggy if-branch to be executed or not executed? You'd have to find the likely culprits and examine their values to be sure, or put print statements (or pylons.util.log()) to see what's being executed. Or... I think there's a way to make Pylons respond to a fake request under the Python debugger, though I'm not sure how.
It's hard to see how function calls in a template could cause this problem, unless an exception was caught and ignored and that caused an invalid value to be set somewhere. I assume you've verified that the problem goes away if you comment out that portion of the template.
Another possibility is your application is doing something thread-unsafe. You can put "threadpool_workers = 1" in [server:main] in the config file to prevent simultaneous requests, and see if the problem goes away.
Something about how send_to_remote() sets up the request or handles it could be the problem, but I haven't tried that so I can't help with that.
-- Mike Orr <slug...@public.gmane.org>




