diff --git a/app/grants/utils.py b/app/grants/utils.py index c7f970bebea..55e1b1e8de2 100644 --- a/app/grants/utils.py +++ b/app/grants/utils.py @@ -197,13 +197,13 @@ def generate_collection_thumbnail(collection, width, heigth): if grant.logo: if len(logos) > DISPLAY_GRANTS_LIMIT: break - - fd = urllib.request.urlopen(f'{media_url}{grant.logo.url}') + grant_url = f'{media_url}{grant.logo.url}' + print(f'Trying to get: ${grant_url}') + fd = urllib.request.urlopen(grant_url) logos.append(fd) else: - static_file = static(f'/v2/images/grants/logos/{grant.id % 3}.png') - logo = urllib.request.urlopen(f'{STATIC_HOST[:-1]}{static_file}') - logos.append(logo) + static_file = f'assets/v2/images/grants/logos/{grant.id % 3}.png' + logos.append(static_file) for logo in range(len(logos), 4): logos.append(None) @@ -242,7 +242,7 @@ def generate_collection_thumbnail(collection, width, heigth): thumbail.paste(grant_bg, CORNERS[index], grant_bg) continue - if re.match(r'.*\.svg', logos[index].url): + if type(logos[index]) is not str and re.match(r'.*\.svg', logos[index].url): grant_img = convert_img(logos[index]) grant_thumbail = Image.open(grant_img) else: