Skip to content

Commit

Permalink
Merge pull request #655 from kobotoolbox/654-cannot-set-uuid-with-uni…
Browse files Browse the repository at this point in the history
…code

Force xml as unicode
  • Loading branch information
noliveleger authored Sep 30, 2020
2 parents 6eef7d5 + 8e5bea8 commit 5c3a684
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions onadata/apps/viewer/models/data_dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@

from django.db import models
from django.db.models.signals import post_save
from django.utils.encoding import smart_text
from guardian.shortcuts import assign_perm, get_perms_for_model
from pyxform import SurveyElementBuilder
from pyxform.builder import create_survey_from_xls
from pyxform.question import Question
from pyxform.section import RepeatingSection
from pyxform.xform2json import create_survey_element_from_xml
from xml.dom import Node

from onadata.apps.logger.models.xform import XForm
from onadata.apps.logger.xform_instance_parser import clean_and_parse_xml
from onadata.apps.api.mongo_helper import MongoHelper
Expand Down Expand Up @@ -137,7 +137,7 @@ def set_uuid_in_xml(self, file_name=None, id_string=None):
# and-silly-whitespace/
text_re = re.compile(r'>\n\s+([^<>\s].*?)\n\s+</', re.DOTALL)
output_re = re.compile(r'\n.*(<output.*>)\n( )*')
pretty_xml = text_re.sub(r'>\g<1></', self.xml)
pretty_xml = text_re.sub(r'>\g<1></', smart_text(self.xml))
inline_output = output_re.sub(r'\g<1>', pretty_xml)
inline_output = re.compile(r'<label>\s*\n*\s*\n*\s*</label>').sub(
'<label></label>', inline_output)
Expand Down

0 comments on commit 5c3a684

Please sign in to comment.