171: Error on creating new review request when accessing authentication SVN
- Fixed
- Review Board
mhorva******@gmai***** (Google Code) (Is this you? Claim this profile.) | |
|
|
Aug. 28, 2007 |
I'd like to create a new review request, but when I just see this error: Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/django/core/handlers/base.py" in get_response 77. response = callback(request, *callback_args, **callback_kwargs) File "/reviewboard/djblets/auth/util.py" in _checklogin 45. return view_func(request, *args, **kwargs) File "/reviewboard/reviews/views.py" in new_review_request 86. fields[repo.id] = repo.get_scmtool().get_fields() File "/reviewboard/../reviewboard/scmtools/models.py" in get_scmtool 42. return cls(self) File "/reviewboard/scmtools/svn.py" in __init__ 16. self.client.set_default_username(repository.username) TypeError at /r/new/ cannot return std::string from Unicode object The error message says all ...
Not sure if this is really our bug or pysvn's. Can you tell me what username you're using, or more specifically, if the username has any non-alpha-numeric characters in it?
-
+ NeedInfo
I'm getting the same exact error. To me it looks like it is related to the svn credentials cache - creating reviews works when you've already checked out a repository under a user account currently running the reviewboard app. Try getting rid of the credentials in your repository setup and try again.
Well, if I fill in the user credentials in /reviewboard/scmtools/svn.py (line 16 to 18), it works. But this wouldn't be a solution. Anyway, it looks to me like a bug of reviewboard, not pysvn. Cheers, Max!
The bug appears to be with pysvn. pysvn.Client cannot handle the Unicode strings Django is returning although the exception message appears to originate in the Py:String class (search for "cannot return std::string from Unicode object") [1]. The bug can be fixed by forcing the username and password to a non-Unicode encoding before passing them to the pysvn client. Here is how I recreated the issue: >>> import pysvn >>> client = pysvn.Client() >>> client.set_default_username(u'huddlej') Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: cannot return std::string from Unicode object >>> client.set_default_username(u'huddlej'.encode('utf-8')) >>> My guess is since Django merged the Unicode branch all Review Board settings are being returned as Unicode. It would be interesting to know if anyone using a pre-Unicode-merge Django version is having the same trouble. [1] http://inkscape.modevia.com/doxygen/html/classPy_1_1String.php
Attached is an example patch if that helps...
-
+
It's working for me. The str() change seems to have done the trick. Thanks!