File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed
Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change 1616# See the License for the specific language governing permissions and
1717# limitations under the License.
1818import sys
19+ import six
1920import string
2021
2122from .Nodes import RootNode
@@ -44,8 +45,7 @@ def __init__(self, msg):
4445
4546
4647def to_xml_string (s ):
47- #s = xml_sax_escape(s, {'"': '"'})
48- s = s .encode ("ascii" , "xmlcharrefreplace" ).decode ('ascii' )
48+ s = xml_sax_escape (s , {'"' : '"' })
4949 return s
5050
5151
@@ -154,11 +154,8 @@ def rec(root_node):
154154 f = _make_template_xml_view (root_node , cache = cache )
155155 subs_strs = []
156156 for sub in root_node .fast_substitutions ():
157- # ugly hack for supporting is-string on py2 and py3
158- if sys .version_info < (3 , ) and isinstance (sub , basestring ):
159- subs_strs .append (sub )
160- elif sys .version_info >= (3 , ) and isinstance (sub , str ):
161- subs_strs .append (sub )
157+ if isinstance (sub , six .string_types ):
158+ subs_strs .append (sub .replace ('&' , '&' ))
162159 elif isinstance (sub , RootNode ):
163160 subs_strs .append (rec (sub ))
164161 elif sub is None :
You can’t perform that action at this time.
0 commit comments