fix issues with unicode filename

This commit is contained in:
j 2014-02-26 20:15:31 +05:30
parent 79b96490f9
commit 91a85ebbc4

View file

@ -220,7 +220,7 @@ class Client(object):
if not os.path.exists(os.path.dirname(db_conn)):
os.makedirs(os.path.dirname(db_conn))
conn = sqlite3.connect(db_conn, timeout=10)
conn.text_factory = sqlite3.OptimizedUnicode
conn.text_factory = str
return conn, conn.cursor()
def media_cache(self):
@ -902,8 +902,9 @@ class API(ox.API):
#upload media
if os.path.exists(i['media']):
size = ox.format_bytes(os.path.getsize(i['media']))
print "uploading %s of %s (%s)" % (profile, os.path.basename(filename), size)
url = self.url + 'upload/' + '?profile=' + str(profile) + '&id=' + i['oshash']
name = os.path.basename(filename).decode('utf-8')
print (u"uploading %s of %s (%s)" % (profile, name, size)).encode('utf-8')
url = self.url + 'upload/?profile=%s&id=%s' % (profile, i['oshash'])
if not self.upload_chunks(url, i['media'], data):
if DEBUG:
print "failed"