return choices as unicode and not string,

might as well have jsonp return unicode
This commit is contained in:
Pavel Savchenko 2012-11-01 15:00:22 +02:00
parent 027c9079f6
commit d3aedd5fb1

View File

@ -100,7 +100,7 @@ class JSONPRenderer(JSONRenderer):
callback = self.get_callback(renderer_context) callback = self.get_callback(renderer_context)
json = super(JSONPRenderer, self).render(data, accepted_media_type, json = super(JSONPRenderer, self).render(data, accepted_media_type,
renderer_context) renderer_context)
return "%s(%s);" % (callback, json) return u"%s(%s);" % (callback, json)
class XMLRenderer(BaseRenderer): class XMLRenderer(BaseRenderer):
@ -306,7 +306,7 @@ class BrowsableAPIRenderer(BaseRenderer):
if getattr(widget, 'choices', None): if getattr(widget, 'choices', None):
choices = widget.choices choices = widget.choices
if any([ident != desc for (ident, desc) in choices]): if any([ident != desc for (ident, desc) in choices]):
choices = [(ident, "%s (%s)" % (desc, ident)) choices = [(ident, u"%s (%s)" % (desc, ident))
for (ident, desc) in choices] for (ident, desc) in choices]
widget.choices = choices widget.choices = choices
kwargs['widget'] = widget kwargs['widget'] = widget