1476: TypeError: character mapping must return integer, None or unicode

keithho*******@gmai***** (Google Code) (Is this you? Claim this profile.)
chipx86
chipx86
Feb. 22, 2010
What version are you running?
1.0.5.1

What's the URL of the page containing the problem?
Not publicly accessible.

What steps will reproduce the problem?
1. Create a new review.
2. Fill in the fields.  Diff is ok.
3. Receive json/django error on publish:
"TypeError: character mapping must return integer, None or unicode"

What is the expected output? What do you see instead?
Expected: publish review
Observed: Server 500 error

What operating system are you using? What browser?
Reviewboard is running on Ubuntu Linux 9.10.
I'm accessing it from Windows Vista with Firfox 3.5.

Please provide any additional information below.

This may be a system configuration problem on my side, in which the bug is
simply that reviewboard ought to provide better information regarding the
situation.
#1 keithho*******@gmai***** (Google Code) (Is this you? Claim this profile.)
Error page attached
  • +
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" lang="en"><head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
     
      <title> | Review Request | Review Board</title>
      <script type="text/javascript">
        var AJAX_SERIAL = "1263842806";
        var MEDIA_SERIAL = "1255919511";
        var MEDIA_URL = "/reviews/media/";
        var SITE_ROOT = "/reviews/";
        var LOGGED_IN = true;
      /*
       * Initial state from the server. These should all be thought of as
       * constants, not state.
       */
      var gBugTrackerURL = "http://breckenridge.digidata.com/trac/test/ticket/%s";
      var gReviewRequestPath = '/reviews/r/90/';
      var gReviewRequestId = "90";
      var gReviewRequestSummary = "";
      var gReviewPending = false;
      var gEditable = true;
      var gUserURL = "/reviews/users/khoffman/";
      var gUserAuthenticated = true;
#2 keithho*******@gmai***** (Google Code) (Is this you? Claim this profile.)
Here's the log.  Pretty much the same 

2010-01-28 12:19:13,515 - ERROR - Exception thrown for user obscuredUser at
http://obscureddomain.com/reviews/api/json/reviewrequests/90/publish/

character mapping must return integer, None or unicode
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.6/django/core/handlers/base.py", line 92, in
get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "/usr/lib/pymodules/python2.6/django/views/decorators/cache.py", line 44, in
_wrapped_view_func
    response = view_func(request, *args, **kwargs)
  File
"/usr/local/lib/python2.6/dist-packages/Djblets-0.5.6-py2.6.egg/djblets/webapi/decorators.py",
line 59, in _checklogin
    response = view_func(request, *args, **kwargs)
  File
"/usr/local/lib/python2.6/dist-packages/ReviewBoard-1.0.5.1-py2.6.egg/reviewboard/webapi/json.py",
line 520, in review_request_publish
    review_request.publish(request.user)
  File
"/usr/local/lib/python2.6/dist-packages/ReviewBoard-1.0.5.1-py2.6.egg/reviewboard/reviews/models.py",
line 458, in publish
    mail_review_request(user, self, changes)
  File
"/usr/local/lib/python2.6/dist-packages/ReviewBoard-1.0.5.1-py2.6.egg/reviewboard/reviews/email.py",
line 184, in mail_review_request
    extra_context)
  File
"/usr/local/lib/python2.6/dist-packages/ReviewBoard-1.0.5.1-py2.6.egg/reviewboard/reviews/email.py",
line 114, in send_review_mail
    message.send()
  File "/usr/lib/pymodules/python2.6/django/core/mail.py", line 266, in send
    return self.get_connection(fail_silently).send_messages([self])
  File "/usr/lib/pymodules/python2.6/django/core/mail.py", line 166, in send_messages
    new_conn_created = self.open()
  File "/usr/lib/pymodules/python2.6/django/core/mail.py", line 137, in open
    self.connection.login(self.username, self.password)
  File "/usr/lib/python2.6/smtplib.py", line 574, in login
    (code, resp) = self.docmd(encode_cram_md5(resp, user, password))
  File "/usr/lib/python2.6/smtplib.py", line 538, in encode_cram_md5
    response = user + " " + hmac.HMAC(password, challenge).hexdigest()
  File "/usr/lib/python2.6/hmac.py", line 72, in __init__
    self.outer.update(key.translate(trans_5C))
TypeError: character mapping must return integer, None or unicode

Any ideas?
#3 keithho*******@gmai***** (Google Code) (Is this you? Claim this profile.)
Our install of reviewboard is still down.  I'd love some ideas if someone has any.  I
initially installed Reviewboard on Ubuntu Server 8.04 and then upgraded to 9.10.  The
problems appeared after that.  I'm thinking this may not be a bug but rather a django
issue but if anyone has any ideas for me, I'd appreciate it.
#4 keithho*******@gmai***** (Google Code) (Is this you? Claim this profile.)
I appear to be running Djblets-0.5.6-py2.6 and Django-1.1.1-py2.6 if that helps at
all.  Thanks for any suggestions!
#5 keithho*******@gmai***** (Google Code) (Is this you? Claim this profile.)
I did a little more research here.

Despite the 500 server error when you try to publish, your review or comments or
sign-off on the review get published.  After clicking publish, you dismiss the 500
error and 'discard' (not really) the changes.  If you or someone else views the
review again, your changes are present.

However, no emails are sent out for the publication or review comments.
#6 keithho*******@gmai***** (Google Code) (Is this you? Claim this profile.)
Reviewboard 1.0.5.1
Python 2.6
Ubuntu Server 9.10
Djblets-0.5.6.-py2.6
Django-1.1.1-py2.6
#7 keithho*******@gmai***** (Google Code) (Is this you? Claim this profile.)
Any ideas?  I'd really appreciate it.
david
#8 david
It sounds like your server is configured with a broken SMTP username/password. Can you 
check your configuration and make sure it's what you expect?
  • +NeedInfo
#9 keithho*******@gmai***** (Google Code) (Is this you? Claim this profile.)
Well, I got IT to create a new user and new password and confirmed the details of the
port and server.

It looks to me like reviewboard is discarding my settings changes.  We use port 587.

Steps to reproduce:
1.  Go to the Email settings in the Admin page
2.  Set the email settings to something other than port 25.
3.  Save the settings.
4.  Close the browser tab and open a new tab and go back to the Email settings. 
Settings look ok.
5.  Close browser tab.
6.  Open new one and create a new review.
7.  On publish, get a 500 error.  Details show a TypeError.  Look in the error
details and see:
EMAIL_PORT  	
25
8.  Go back to the Email settings page in the Admin tool and see all the changes have
been discarded. It converts the settings back not just on the port but on the
username and password.

Why has this issue arisen in a stable reviewboard configuration?  I upgraded and I
think it stomped the port # (bug 1) and won't keep the changes (bug 2).

Our development team actively uses reviewboard so I'd appreciate any assistance you
can provide.
david
#10 david
You may need to restart apache after making your settings changes.
#11 keithho*******@gmai***** (Google Code) (Is this you? Claim this profile.)
Ok, more information.  On returning to the Admin page this evening, the changes had
been saved.  So that issue is apparently some kind of caching issue (no apache
restart performed).  However, the error did not change (except that the mail port and
user were as expected).  I performed an apache restart.  Same error as before.
chipx86
#12 chipx86
The cached settings issue is a known bug, even in the stable releases. I've been
trying to figure it out.

I found out that we're not the only people who have had this bug reported. Looks like
HMAC doesn't like Unicode strings particularly, which is what the username and
password are in. I'll make a change to ensure that these settings are stored as
non-unicode strings.
  • -NeedInfo
    +Started
  • -Priority-Medium
    +Priority-High
    +Component-EMail
    +Component-Settings
  • +chipx86
chipx86
#13 chipx86
  • +Milestone-Release1.5
chipx86
#14 chipx86
A fix is up at http://reviews.reviewboard.org/r/1426/

Hoping to get it into tonight's nightly build of Djblets.
  • -Started
    +PendingReview
  • +Djblets
chipx86
#15 chipx86
  • -PendingReview
    +Fixed