Created on 2010-02-24.11:17:36 by benallard, last changed 2010-07-23.18:20:25 by mpm.
| msg12382 (view) |
Author: santagada |
Date: 2010-04-25.21:10:50 |
|
As tonfa advised checking for basestring instead of str because unicode is
also valid in this case.
diff --git a/mercurial/hgweb/protocol.py b/mercurial/hgweb/protocol.py
--- a/mercurial/hgweb/protocol.py
+++ b/mercurial/hgweb/protocol.py
@@ -179,8 +179,8 @@
raise ErrorResponse(HTTP_OK, inst)
except (OSError, IOError), inst:
error = getattr(inst, 'strerror', 'Unknown error')
- if not isinstance(error, str):
- error = 'Error: %s' % str(error)
+ if not isinstance(error, basestring):
+ error = 'Error: %s' % inst.__class__.__name__
if inst.errno == errno.ENOENT:
code = HTTP_NOT_FOUND
else:
|
| msg12381 (view) |
Author: santagada |
Date: 2010-04-25.20:41:43 |
|
I would do this, as an error message of "Error: None" would not be very
useful. A way to actually test this would be nice also.
diff --git a/mercurial/hgweb/protocol.py b/mercurial/hgweb/protocol.py
--- a/mercurial/hgweb/protocol.py
+++ b/mercurial/hgweb/protocol.py
@@ -180,7 +180,7 @@
except (OSError, IOError), inst:
error = getattr(inst, 'strerror', 'Unknown error')
if not isinstance(error, str):
- error = 'Error: %s' % str(error)
+ error = 'Error: %s' % inst.__class__.__name__
if inst.errno == errno.ENOENT:
code = HTTP_NOT_FOUND
else:
|
| msg12345 (view) |
Author: pmezard |
Date: 2010-04-22.09:17:36 |
|
Changing to testing
|
| msg12317 (view) |
Author: brendan |
Date: 2010-04-20.00:00:52 |
|
See http://hg.intevation.org/mercurial/crew/rev/5dc09507b90e
(hgweb: fix attribute error in error response (issue2060))
|
| msg12199 (view) |
Author: qwerty360 |
Date: 2010-04-01.14:31:01 |
|
adding a str call would work.
However in the case below it is happening because error = None. I think the
intention in this situation was to have text = 'Unknown error', especially
as returning 'None' as an error will confuse people.
As a fix I would suggest the following (although this hasn't been properly
tested it should work):
diff -r ef3668450cd0 mercurial/hgweb/protocol.py
--- a/mercurial/hgweb/protocol.py Tue Mar 30 13:09:25 2010 -0500
+++ b/mercurial/hgweb/protocol.py Thu Apr 01 15:30:11 2010 +0100
@@ -179,6 +179,8 @@
raise ErrorResponse(HTTP_OK, inst)
except (OSError, IOError), inst:
error = getattr(inst, 'strerror', 'Unknown error')
+ if type(error) != str:
+ error = 'Unknown error: %s' % str(error)
if inst.errno == errno.ENOENT:
code = HTTP_NOT_FOUND
else:
|
| msg11873 (view) |
Author: tonfa |
Date: 2010-02-24.11:26:27 |
|
We probably need to add a str() call, but it's weird that strerror isn't a
string...
text = str(error).replace(repo.root + os.path.sep, '')
This bug should happen in 1.4 too.
|
| msg11872 (view) |
Author: benallard |
Date: 2010-02-24.11:17:36 |
|
This is resulting in a Error 500, and it occurred several times over the
last week. Each time, I had to restart the server.
I am running an almost-up-to-date stable changeset.
[Wed Feb 24 11:30:32 2010] [error] [client 10.0.8.53] mod_wsgi (pid=20511):
Exception occurred processing WSGI script '/var/hg/hgwebdir.wsgi'.
[Wed Feb 24 11:30:32 2010] [error] [client 10.0.8.53] Traceback (most recent
call last):
[Wed Feb 24 11:30:32 2010] [error] [client 10.0.8.53] File
"/usr/local/lib/python2.4/site-packages/mercurial/hgweb/hgwebdir_mod.py",
line 103, in __call__
[Wed Feb 24 11:30:32 2010] [error] [client 10.0.8.53] return
self.run_wsgi(req)
[Wed Feb 24 11:30:32 2010] [error] [client 10.0.8.53] File
"/usr/local/lib/python2.4/site-packages/mercurial/hgweb/hgwebdir_mod.py",
line 160, in run_wsgi
[Wed Feb 24 11:30:32 2010] [error] [client 10.0.8.53] return
hgweb(repo).run_wsgi(req)
[Wed Feb 24 11:30:32 2010] [error] [client 10.0.8.53] File
"/usr/local/lib/python2.4/site-packages/mercurial/hgweb/hgweb_mod.py", line
123, in run_wsgi
[Wed Feb 24 11:30:32 2010] [error] [client 10.0.8.53] return
method(self.repo, req)
[Wed Feb 24 11:30:32 2010] [error] [client 10.0.8.53] File
"/usr/local/lib/python2.4/site-packages/mercurial/hgweb/protocol.py", line
196, in unbundle
[Wed Feb 24 11:30:32 2010] [error] [client 10.0.8.53] text =
error.replace(repo.root + os.path.sep, '')
[Wed Feb 24 11:30:32 2010] [error] [client 10.0.8.53] AttributeError:
'NoneType' object has no attribute 'replace'
I have a buildbot hook sending lot of twisted warnings about Signals in the
logs also, might be related. I don't think so though.
|
|
| Date |
User |
Action |
Args |
| 2010-07-23 18:20:25 | mpm | set | status: testing -> resolved nosy:
tonfa, brendan, pmezard, djc, benallard, cyanite, qwerty360, santagada |
| 2010-04-25 21:10:50 | santagada | set | nosy:
tonfa, brendan, pmezard, djc, benallard, cyanite, qwerty360, santagada messages:
+ msg12382 |
| 2010-04-25 20:41:43 | santagada | set | nosy:
+ santagada messages:
+ msg12381 |
| 2010-04-22 09:17:36 | pmezard | set | status: chatting -> testing nosy:
tonfa, brendan, pmezard, djc, benallard, cyanite, qwerty360 messages:
+ msg12345 |
| 2010-04-20 00:00:52 | brendan | set | nosy:
+ brendan messages:
+ msg12317 |
| 2010-04-01 14:31:01 | qwerty360 | set | nosy:
+ qwerty360 messages:
+ msg12199 |
| 2010-02-24 11:59:31 | pmezard | set | nosy:
+ pmezard |
| 2010-02-24 11:26:27 | tonfa | set | status: unread -> chatting nosy:
+ tonfa messages:
+ msg11873 |
| 2010-02-24 11:17:36 | benallard | create | |
|