safe file directly to avoid django renaming
This commit is contained in:
parent
407bfb9eb6
commit
21f21e404e
1 changed files with 4 additions and 1 deletions
|
@ -75,7 +75,10 @@ class PosterCache(models.Model):
|
|||
name = hashlib.sha1(url).hexdigest()
|
||||
try:
|
||||
data = ox.net.readUrl(url)
|
||||
self.image.save(name, ContentFile(data))
|
||||
self.image.name = poster.models.poster_path(self.url, 'image.jpg')
|
||||
with open(self.image.path, 'w') as f:
|
||||
f.write(data)
|
||||
self.save()
|
||||
except ox.net.urllib2.HTTPError, e:
|
||||
#import traceback
|
||||
#print traceback.print_exc()
|
||||
|
|
Loading…
Reference in a new issue