#20856: Error with admin popups: expected a character buffer object
-------------------------------------+-------------------------------------
     Reporter:  heppner.mark@…       |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  contrib.admin        |                  Version:  1.6
     Severity:  Normal               |               Resolution:
     Keywords:  admin, str,          |             Triage Stage:
  character, inline, popup           |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Natim87):

 * cc: Natim87 (added)
 * status:  closed => new
 * version:  1.5 => 1.6
 * resolution:  needsinfo =>


Comment:

 I have the exact same problem when I set my primary key to be UUID.

 {{{
    >>> value
    UUID('c7e0b63c79974727a659428c8d734db3')
    >>> force_text(value)
    'c7e0b63c79974727a659428c8d734db3'
    >>> _js_escapes
    {0: u'\\u0000', 1: u'\\u0001', 2: u'\\u0002', 3: u'\\u0003', 4:
 u'\\u0004', 5: u'\\u0005', 6: u'\\u0006', 7: u'\\u0007', 8: u'\\u0008', 9:
 u'\\u0009', 10: u'\\u000A', 11: u'\\u000B', 12: u'\\u000C', 13:
 u'\\u000D', 14: u'\\u000E', 15: u'\\u000F', 16: u'\\u0010', 17:
 u'\\u0011', 18: u'\\u0012', 19: u'\\u0013', 20: u'\\u0014', 21:
 u'\\u0015', 22: u'\\u0016', 23: u'\\u0017', 24: u'\\u0018', 25:
 u'\\u0019', 26: u'\\u001A', 27: u'\\u001B', 28: u'\\u001C', 29:
 u'\\u001D', 30: u'\\u001E', 31: u'\\u001F', 34: u'\\u0022', 38:
 u'\\u0026', 39: u'\\u0027', 8232: u'\\u2028', 8233: u'\\u2029', 45:
 u'\\u002D', 59: u'\\u003B', 60: u'\\u003C', 61: u'\\u003D', 62:
 u'\\u003E', 92: u'\\u005C'}
     >>> force_text(value).translate(_js_escapes)
     *** TypeError: expected a character buffer object
 }}}

 It looks like sometimes, the force_text doesn't return a unicode object
 but a str one, then this error is raised.

 django/utils/html.py in escapejs line 62 with Django 1.6.1

-- 
Ticket URL: <https://code.djangoproject.com/ticket/20856#comment:6>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/080.a6e54c0283b1cccf4ca06dad25c0857d%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to