#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
-------------------------------------+-------------------------------------
Comment (by Natim87):
What I don't understand is that if I run the code behind from a clean
shell, force_text(value) returns me a unicode string.
But when adding a PDB and running this, I get a str as writting before.
From the shell:
{{{
>>> from django.utils.encoding import force_text
>>> from uuid import UUID
>>> value = UUID('c7e0b63c79974727a659428c8d734db3')
>>> force_text(value)
u'c7e0b63c-7997-4727-a659-428c8d734db3'
}}}
From PDB:
{{{
(Pdb) value
UUID('c7e0b63c79974727a659428c8d734db3')
(Pdb) force_text(value)
'c7e0b63c79974727a659428c8d734db3'
(Pdb) l
57 _js_escapes.update((ord('%c' % z), '\\u%04X' % z) for z in
range(32))
58
59 def escapejs(value):
60 """Hex encodes characters for use in JavaScript strings."""
61 import pdb; pdb.set_trace()
62 -> return mark_safe(force_text(value).translate(_js_escapes))
63 escapejs = allow_lazy(escapejs, six.text_type)
64
65 def conditional_escape(text):
66 """
67 Similar to escape(), except that it doesn't operate on pre-
escaped strings.
(Pdb)
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/20856#comment:7>
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.c9f385ca34c3f010485e0b6267392b2c%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.