use extension from url

This commit is contained in:
j 2012-07-05 15:51:57 +02:00
parent e3ffa98d92
commit ece58dad63

View file

@ -76,7 +76,7 @@ class PosterCache(models.Model):
name = hashlib.sha1(url).hexdigest() name = hashlib.sha1(url).hexdigest()
try: try:
data = ox.net.readUrl(url) data = ox.net.readUrl(url)
self.image.name = poster_path(self.url, 'image.jpg') self.image.name = poster_path(self.url, os.path.basename(url))
ox.makedirs(os.path.dirname(self.image.path)) ox.makedirs(os.path.dirname(self.image.path))
with open(self.image.path, 'w') as f: with open(self.image.path, 'w') as f:
f.write(data) f.write(data)