Private
Public Access
1
0

fixed chinese file name

This commit is contained in:
Sander Roosendaal
2018-12-27 14:38:08 +01:00
parent e434582e85
commit 39c7bff4ef
4 changed files with 204 additions and 6 deletions

View File

@@ -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