I have been able to reproduce a bug with the welcome app when routes on
error is in use on localhost:
Steps to reproduce:
1.- create an app "myapp"
2.- create another app "errors"
3.- Edit routes.py
default_application = 'myapp' # ordinarily set in base routes.py
default_controller = 'index' # ordinarily set in app-specific routes.py
default_function = 'index' # ordinarily set in app-specific routes.py
routes_onerror = [(r'*/*', r'errors/errors/index')]
applications/errors/errors.py (error handler)
def index():
code = request.vars.code
ticket = request.vars.ticket
print "processing error"
print code
print ticket
return "Error processed"
applications/myapp/controller/index.py:
response.view = "index.html"
def index():
if request.ajax:
print "ajax"
raise HTTP(404, "Cant do")
return locals()
applications/myapp/views/index.html
<!DOCTYPE html>
<html>
<head>
<title>App</title>
</head>
<body>
<h1>App</h1>
<p>Welcome</p>
<script type="text/javascript" src="/myapp/static/js/jquery.js"></script>
<script type="text/javascript">
function saved(){
console.log("got response");
}
$.post({url: "/", data:{name: "Pepe", last: "Mario"}}, saved)
</script>
</body>
</html>
In the console we get this error:
ERROR:Rocket.Errors.Thread-2:Traceback (most recent call last):
File "C:\Users\Stark\Desktop\Projects\datatabs\gluon\rocket.py", line 1288
, in run
self.run_app(conn)
File "C:\Users\Stark\Desktop\Projects\datatabs\gluon\rocket.py", line 1789
, in run_app
output = self.app(environ, self.start_response)
File "C:\Users\Stark\Desktop\Projects\datatabs\gluon\main.py", line 649,
in app_with_logging
ret[0] = wsgiapp(environ, responder2)
File "C:\Users\Stark\Desktop\Projects\datatabs\gluon\main.py", line 560,
in wsgibase
return wsgibase(new_environ, responder)
File "C:\Users\Stark\Desktop\Projects\datatabs\gluon\main.py", line 530,
in wsgibase
if request.body:
File "C:\Users\Stark\Desktop\Projects\datatabs\gluon\globals.py", line 280
, in body
raise HTTP(400, "Bad Request - HTTP body is incomplete")
HTTP: 400 BAD REQUEST
And the response takes 15 seconds with an error 500 instead the 404, "Cant
do" from the controller.
Chasing the console error, for some reaosn it fails at globals.py line 280
self._body = copystream_progress(self)
specifically at copystream globals.py line 126:
if 'X-Progress-ID' not in request.get_vars:
copystream(source, dest, size, chunk_size)
return dest
i have tried to change it to request.post_vars but didnt work. Not sure
whats wrong.
Any idea what is going wrong?
Thanks
Best Regards.
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/a77d48b8-5761-4aa8-9c85-08d5539121c1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.