makedirs
This commit is contained in:
parent
752242e40c
commit
e3ffa98d92
1 changed files with 2 additions and 0 deletions
|
@ -11,6 +11,7 @@ from django.db.models import Q
|
|||
from django.contrib.auth.models import User
|
||||
from django.core.files.base import ContentFile
|
||||
|
||||
import ox
|
||||
import ox.web.criterion
|
||||
import ox.web.movieposterdb
|
||||
import ox.web.imdb
|
||||
|
@ -76,6 +77,7 @@ class PosterCache(models.Model):
|
|||
try:
|
||||
data = ox.net.readUrl(url)
|
||||
self.image.name = poster_path(self.url, 'image.jpg')
|
||||
ox.makedirs(os.path.dirname(self.image.path))
|
||||
with open(self.image.path, 'w') as f:
|
||||
f.write(data)
|
||||
self.save()
|
||||
|
|
Loading…
Reference in a new issue