remove unnecessary check and try using the dialects type

pull/59/head
justcool393 2022-12-09 21:07:15 -06:00
parent e755061bc6
commit 548ef45dbf
3 changed files with 6 additions and 10 deletions

View File

@ -4,7 +4,8 @@ from typing import Optional
from sqlalchemy import Column from sqlalchemy import Column
from sqlalchemy.orm import relationship from sqlalchemy.orm import relationship
from sqlalchemy.sql.sqltypes import * from sqlalchemy.types import VARCHAR, Boolean, Integer
from sqlalchemy.dialects.postgresql import ARRAY
from files.classes import Base from files.classes import Base
from files.helpers.lazy import lazy from files.helpers.lazy import lazy

View File

@ -124,8 +124,6 @@ def process_video(file, v):
return new return new
def process_image(filename:str, v, resize=0, trim=False, uploader_id:Optional[int]=None, db=None): def process_image(filename:str, v, resize=0, trim=False, uploader_id:Optional[int]=None, db=None):
# thumbnails are processed in a thread and not in the request context # thumbnails are processed in a thread and not in the request context
# if an image is too large or webp conversion fails, it'll crash # if an image is too large or webp conversion fails, it'll crash

View File

@ -462,14 +462,11 @@ def upload_sub_banner(v:User, sub:str):
file.save(name) file.save(name)
bannerurl = process_image(name, v, resize=1200) bannerurl = process_image(name, v, resize=1200)
if bannerurl: if sub.bannerurls:
if sub.bannerurls: sub.bannerurls.append(bannerurl)
sub.bannerurls.append(bannerurl)
else:
sub.bannerurls = [bannerurl]
g.db.add(sub)
else: else:
abort(400, "No banner uploaded") sub.bannerurls = [bannerurl]
g.db.add(sub)
ma = SubAction( ma = SubAction(
sub=sub.name, sub=sub.name,