#30583: xml serializing doesn't work with JSONField
------------------------------------------------+------------------------
               Reporter:  ustnv                 |          Owner:  nobody
                   Type:  Bug                   |         Status:  new
              Component:  Core (Serialization)  |        Version:  2.2
               Severity:  Normal                |       Keywords:
           Triage Stage:  Unreviewed            |      Has patch:  0
    Needs documentation:  0                     |    Needs tests:  0
Patch needs improvement:  0                     |  Easy pickings:  0
                  UI/UX:  0                     |
------------------------------------------------+------------------------
 I have code:

 {{{
 data = serializers.serialize("xml", queryset, fields=fields)
 }}}

 if I choose specific fields, which are not JSONField, it is ok. But if I
 choose field, which is JSONField, I receive error
 {{{
  File "/Users/ustnv/PycharmProjects/fpg_nko/venv/lib/python3.6/site-
 packages/django/core/serializers/__init__.py", line 128, in serialize
     s.serialize(queryset, **options)
   File "/Users/ustnv/PycharmProjects/fpg_nko/venv/lib/python3.6/site-
 packages/django/core/serializers/base.py", line 107, in serialize
     self.handle_field(obj, field)
   File "/Users/ustnv/PycharmProjects/fpg_nko/venv/lib/python3.6/site-
 packages/django/core/serializers/xml_serializer.py", line 79, in
 handle_field
     self.xml.characters(field.value_to_string(obj))
   File "/Users/ustnv/PycharmProjects/fpg_nko/venv/lib/python3.6/site-
 packages/django/utils/xmlutils.py", line 25, in characters
     if content and re.search(r'[\x00-\x08\x0B-\x0C\x0E-\x1F]', content):
   File
 "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/re.py",
 line 182, in search
     return _compile(pattern, flags).search(string)
 TypeError: expected string or bytes-like object
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30583>
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/048.a84fadf100e8f427455638e537bf3935%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to