Please see the patch attached. Tested with IE6, I don't have any others under 
the hand, but deciding on what I've found on the Net - it should work for IE7 
too at least. 

On Sunday 24 May 2009 18:59:57 mdipierro wrote:
> If you find a workaround I am happy to change this.
>
> On May 24, 9:57 am, Alexey Nezhdanov <[email protected]> wrote:
> > В сообщении от Sunday 24 May 2009 18:42:27 mdipierro написал(а):> This
> > was discussed tome time ago. In principle you are correct but if
> >
> > > tickets are not 200 OK IE does not display them.
> >
> > Oh. Isn't IE just doesn't display non-200 pages that are smaller than
> > some specific size? Anyways, I have IE on my box so I'll test it myself.
> >
> > > Massimo
> > >
> > > On May 24, 2:17 am, Alexey Nezhdanov <[email protected]> wrote:
> > > > Here is my problem.
> > > > There is a javascript app that does asyncronous file upload.
> > > > It works nice with web2py when I test it on localhost, but when I
> > > > deliberately tried it over a slow link, I got this:
> > > >
> > > > Traceback (most recent call last):
> > > >   File "/home/snake/python/horst/web2py/gluon/main.py", line 245, in
> > > > wsgibase int(request.env.content_length))
> > > >   File "/home/snake/python/horst/web2py/gluon/fileutils.py", line
> > > > 268, in copystream data = src.read(chunk_size)
> > > >   File "/home/snake/python/horst/web2py/gluon/wsgiserver.py", line
> > > > 193, in read data = self.rfile.read(size)
> > > >   File "/usr/lib/python2.5/socket.py", line 309, in read
> > > >     data = self._sock.recv(recv_size)
> > > > timeout: timed out
> > > >
> > > > There is no any of my code in that trace so I can't affect how that
> > > > is processed. Yet, this trace returns a 200 HTTP page: (Internal
> > > > error / Ticket issued). javascript sees that return code is 200 and
> > > > doesn't react properly to the error. So here is the subject - since
> > > > that's an internal error - shouldn't it be HTTP(500) or at least
> > > > HTTP(400) ?
> > > >
> > > > --
> > > > Sincerely yours
> > > > Alexey Nezhdanov
> >
> > --
> > Sincerely yours
> > Alexey Nezhdanov
>
> 


-- 
Sincerely yours
Alexey Nezhdanov

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

diff --git a/gluon/main.py b/gluon/main.py
index 94b2c68..1bc60f8 100644
--- a/gluon/main.py
+++ b/gluon/main.py
@@ -125,24 +125,6 @@ def serve_controller(request, response, session):
     raise HTTP(200, response.body, **response.headers)
 
 
-def check_error_route(status, app):
-    """ Unless the error code is redirected, we want to send error messages out
-    with HTTP status 200.  Otherwise IE won't display them. """
-
-    error_list = rewriteSymbols.get('routes_onerror', [])
-    error_map = dict(list(error_list))
-
-    if not error_list:
-        return 200
-    for redir in [x[0] for x in error_list]:
-        if redir.endswith('/%s' % status) and error_map[redir] != '!':
-            return status
-        if (redir == '%s/*' % app or redir == '*/*')\
-             and error_map[redir] != '!':
-            return status
-    return 200
-
-
 def wsgibase(environ, responder):
     """
     this is the gluon wsgi application. the furst function called when a page
@@ -365,8 +347,7 @@ def wsgibase(environ, responder):
                 ticket = 'unknown'
                 logging.error(e.traceback)
             session._unlock(response)
-            http_error_status = check_error_route(500, items[0])
-            return HTTP(http_error_status, error_message_ticket
+            return HTTP(500, error_message_ticket
                          % dict(ticket=ticket), web2py_error='ticket %s'
                          % ticket).to(responder)
     except:
@@ -389,8 +370,7 @@ def wsgibase(environ, responder):
             ticket = 'unrecoverable'
             logging.error(e.traceback)
         session._unlock(response)
-        http_error_status = check_error_route(500, items[0])
-        return HTTP(http_error_status, error_message_ticket
+        return HTTP(500, error_message_ticket
                      % dict(ticket=ticket), web2py_error='ticket %s'
                      % ticket).to(responder)
 
diff --git a/gluon/rewrite.py b/gluon/rewrite.py
index 94f96d9..81a3004 100644
--- a/gluon/rewrite.py
+++ b/gluon/rewrite.py
@@ -11,7 +11,10 @@ regex_iter = re.compile(r'.*code=(?P<code>\d+)&ticket=(?P<ticket>.+).*')
 error_message = '<html><body><h1>Invalid request</h1></body></html>'
 error_message_custom = '<html><body><h1>%s</h1></body></html>'
 error_message_ticket = \
-    '<html><body><h1>Internal error</h1>Ticket issued: <a href="/admin/default/ticket/%(ticket)s" target="_blank">%(ticket)s</a></body></html>'
+   ('<html><body><h1>Internal error</h1>Ticket issued: <a href="/admin/default/ticket/%(ticket)s" target="_blank">%(ticket)s</a>\n'
+    '<!-- Why Internet Explorer sucks so much? Nobody knows. But it does much. Don\'t believe it? Remove this message from gluon/rewrite.py -->\n'
+    '<!-- Why Internet Explorer sucks so much? Nobody knows. But it does much. Don\'t believe it? Remove this message from gluon/rewrite.py -->\n'
+    '</body></html>')
 symbols = {}
 
 if os.path.exists('routes.py'):

Reply via email to