fnp
/
redakcja.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
prevent adding new images with existing sources
[redakcja.git]
/
apps
/
cover
/
management
/
commands
/
refresh_covers.py
diff --git
a/apps/cover/management/commands/refresh_covers.py
b/apps/cover/management/commands/refresh_covers.py
index
81ff9b8
..
2c78db9
100644
(file)
--- a/
apps/cover/management/commands/refresh_covers.py
+++ b/
apps/cover/management/commands/refresh_covers.py
@@
-25,6
+25,7
@@
class Command(BaseCommand):
if image.source_url and 'flickr.com' in image.source_url:
try:
flickr_data = get_flickr_data(image.source_url)
if image.source_url and 'flickr.com' in image.source_url:
try:
flickr_data = get_flickr_data(image.source_url)
+ print flickr_data
except FlickrError as e:
print 'Flickr analysis failed: %s' % e
else:
except FlickrError as e:
print 'Flickr analysis failed: %s' % e
else:
@@
-35,12
+36,12
@@
class Command(BaseCommand):
print 'Download url already present in image %s' % same_url.get().id
continue
try:
print 'Download url already present in image %s' % same_url.get().id
continue
try:
- t = URLOpener().open(
image.download
_url).read()
+ t = URLOpener().open(
flickr
_url).read()
except urllib.URLError:
print 'Broken download url'
except IOError:
print 'Connection failed'
else:
except urllib.URLError:
print 'Broken download url'
except IOError:
print 'Connection failed'
else:
- image.download_url = flickr_
data['download_url']
+ image.download_url = flickr_
url
image.file.save(image.file.name, ContentFile(t))
image.save()
image.file.save(image.file.name, ContentFile(t))
image.save()