Fix import error in pyhton 2.6.
This commit is contained in:
parent
4067b17a59
commit
f6a78cb4b2
1 changed files with 7 additions and 2 deletions
|
|
@ -22,10 +22,15 @@ import re
|
||||||
import sys
|
import sys
|
||||||
import logging
|
import logging
|
||||||
import zipfile
|
import zipfile
|
||||||
from collections import OrderedDict
|
|
||||||
from xml.dom.minidom import parseString
|
from xml.dom.minidom import parseString
|
||||||
from jinja2 import Environment, Undefined
|
from jinja2 import Environment, Undefined
|
||||||
|
|
||||||
|
try:
|
||||||
|
from collections import OrderedDict
|
||||||
|
except ImportError:
|
||||||
|
# Its python 2.6
|
||||||
|
pass
|
||||||
|
|
||||||
# Test python versions and normalize calls to basestring, unicode, etc.
|
# Test python versions and normalize calls to basestring, unicode, etc.
|
||||||
try:
|
try:
|
||||||
unicode = unicode
|
unicode = unicode
|
||||||
|
|
@ -305,7 +310,7 @@ class Renderer(object):
|
||||||
def _encode_escape_chars(self, xml_text):
|
def _encode_escape_chars(self, xml_text):
|
||||||
if sys.version_info >= (2, 7):
|
if sys.version_info >= (2, 7):
|
||||||
encode_rules = OrderedDict()
|
encode_rules = OrderedDict()
|
||||||
|
|
||||||
encode_rules = {
|
encode_rules = {
|
||||||
'(?i)(<text:(?:[ahp]|ruby-base|span|meta|meta-field)>.*)(\n)(.*</text:(?:[ahp]|ruby-base|span|meta|meta-field)>)': r'\1<text:line-break/>\3',
|
'(?i)(<text:(?:[ahp]|ruby-base|span|meta|meta-field)>.*)(\n)(.*</text:(?:[ahp]|ruby-base|span|meta|meta-field)>)': r'\1<text:line-break/>\3',
|
||||||
'(?i)(<text:(?:[ahp]|ruby-base|span|meta|meta-field)>.*)(\u0009)(.*</text:(?:[ahp]|ruby-base|span|meta|meta-field)>)': r'\1<text:tab>\3',
|
'(?i)(<text:(?:[ahp]|ruby-base|span|meta|meta-field)>.*)(\u0009)(.*</text:(?:[ahp]|ruby-base|span|meta|meta-field)>)': r'\1<text:tab>\3',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue