Skip to content
This repository has been archived by the owner on Apr 5, 2019. It is now read-only.

Commit

Permalink
Merge pull request #19 from kobotoolbox/briefcase-push-fix
Browse files Browse the repository at this point in the history
Restore support for XML strings in create_survey_element_from_xml
  • Loading branch information
Esmail committed Jul 28, 2015
2 parents 6609028 + 2f09bba commit 6dfff06
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pyxform/xform2json.py
@@ -1,6 +1,7 @@
from __future__ import absolute_import

import os
import io
import re
import json
import copy
Expand Down Expand Up @@ -171,7 +172,10 @@ def ConvertXmlToDict(root, dictclass=XmlDictObject):


def create_survey_element_from_xml(xml_file):
sb = XFormToDictBuilder(xml_file)
if isinstance(xml_file, basestring):
# xml_file may be a string of markup instead of a file-like object
xml_file = io.BytesIO(xml_file)
sb = XFormToDictBuilder(filelike_obj=xml_file)
return sb.survey()


Expand Down

0 comments on commit 6dfff06

Please sign in to comment.