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.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.helpers.lazy import lazy

View File

@ -124,8 +124,6 @@ def process_video(file, v):
return new
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
# 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)
bannerurl = process_image(name, v, resize=1200)
if bannerurl:
if sub.bannerurls:
sub.bannerurls.append(bannerurl)
else:
sub.bannerurls = [bannerurl]
g.db.add(sub)
if sub.bannerurls:
sub.bannerurls.append(bannerurl)
else:
abort(400, "No banner uploaded")
sub.bannerurls = [bannerurl]
g.db.add(sub)
ma = SubAction(
sub=sub.name,