|
@@ -25,7 +25,7 @@ class Formater():
|
|
res = u''
|
|
res = u''
|
|
if value != None:
|
|
if value != None:
|
|
try:
|
|
try:
|
|
- res = unicode(value)
|
|
|
|
|
|
+ res = str(value)
|
|
except:
|
|
except:
|
|
pass
|
|
pass
|
|
return res
|
|
return res
|
|
@@ -36,7 +36,7 @@ class Formater():
|
|
if value != None:
|
|
if value != None:
|
|
if isinstance(value, datetime.datetime):
|
|
if isinstance(value, datetime.datetime):
|
|
res = value.strftime('%Y-%m-%d %H:%M')
|
|
res = value.strftime('%Y-%m-%d %H:%M')
|
|
- elif isinstance(value, unicode):
|
|
|
|
|
|
+ elif isinstance(value, str):
|
|
res = value
|
|
res = value
|
|
return res
|
|
return res
|
|
|
|
|
|
@@ -46,7 +46,7 @@ class Formater():
|
|
if value != None:
|
|
if value != None:
|
|
if isinstance(value, datetime.datetime):
|
|
if isinstance(value, datetime.datetime):
|
|
res = value.strftime('%Y-%m-%d %H:%M:%S')
|
|
res = value.strftime('%Y-%m-%d %H:%M:%S')
|
|
- elif isinstance(value, unicode):
|
|
|
|
|
|
+ elif isinstance(value, str):
|
|
res = value
|
|
res = value
|
|
return res
|
|
return res
|
|
|
|
|
|
@@ -56,7 +56,7 @@ class Formater():
|
|
if value != None:
|
|
if value != None:
|
|
if isinstance(value, datetime.date):
|
|
if isinstance(value, datetime.date):
|
|
res = strfdate(value)
|
|
res = strfdate(value)
|
|
- elif isinstance(value, unicode):
|
|
|
|
|
|
+ elif isinstance(value, str):
|
|
res = value
|
|
res = value
|
|
return res
|
|
return res
|
|
|
|
|
|
@@ -98,7 +98,7 @@ class ExcelImporter():
|
|
@staticmethod
|
|
@staticmethod
|
|
def formatUnicode(value):
|
|
def formatUnicode(value):
|
|
try:
|
|
try:
|
|
- return unicode(value).strip(u' ')
|
|
|
|
|
|
+ return str(value).strip(u' ')
|
|
except:
|
|
except:
|
|
return ''
|
|
return ''
|
|
|
|
|
|
@@ -116,14 +116,14 @@ class ExcelImporter():
|
|
@staticmethod
|
|
@staticmethod
|
|
def formatInt(value):
|
|
def formatInt(value):
|
|
try:
|
|
try:
|
|
- return int(float(unicode(value).strip(u' ')))
|
|
|
|
|
|
+ return int(float(str(value).strip(u' ')))
|
|
except:
|
|
except:
|
|
raise CustomError(u'不能转换为整数')
|
|
raise CustomError(u'不能转换为整数')
|
|
|
|
|
|
@staticmethod
|
|
@staticmethod
|
|
def formatFloat(value):
|
|
def formatFloat(value):
|
|
try:
|
|
try:
|
|
- return round(float(unicode(value).strip(u' ')) or 0,2)
|
|
|
|
|
|
+ return round(float(str(value).strip(u' ')) or 0,2)
|
|
except:
|
|
except:
|
|
raise CustomError(u'不能转换为小数')
|
|
raise CustomError(u'不能转换为小数')
|
|
|
|
|
|
@@ -144,7 +144,7 @@ class ExcelImporter():
|
|
@staticmethod
|
|
@staticmethod
|
|
def formatTel(value):
|
|
def formatTel(value):
|
|
try:
|
|
try:
|
|
- value = unicode(value).strip(u' ')
|
|
|
|
|
|
+ value = str(value).strip(u' ')
|
|
except:
|
|
except:
|
|
value = ''
|
|
value = ''
|
|
if value == '':
|
|
if value == '':
|