fixed chinese file name
This commit is contained in:
@@ -58,7 +58,7 @@ def processattachment(rower, fileobj, title, uploadoptions,testing=False):
|
||||
try:
|
||||
with open('media/'+filename,'r') as fop:
|
||||
line = fop.readline()
|
||||
except IOError:
|
||||
except (IOError, UnicodeEncodeError):
|
||||
if testing:
|
||||
print 'IOError',filename,'media/'+filename
|
||||
return 0
|
||||
@@ -211,8 +211,15 @@ class Command(BaseCommand):
|
||||
else:
|
||||
# move attachment and make workout
|
||||
if testing:
|
||||
print name
|
||||
print attachment.document
|
||||
try:
|
||||
print name
|
||||
except UnicodeEncodeError:
|
||||
print "Unicode Error"
|
||||
try:
|
||||
print attachment.document
|
||||
except UnicodeEncodeError:
|
||||
pass
|
||||
|
||||
workoutid = processattachment(
|
||||
rower, attachment.document, name, uploadoptions,
|
||||
testing=testing
|
||||
|
||||
Reference in New Issue
Block a user