fix: replace deprecated datetime.utcnow with timezone-aware datetime.now in all modules and fix comment count query column name

This commit is contained in:
2026-05-14 02:12:19 +00:00
parent cb0fccb270
commit 34cae11630
25 changed files with 82 additions and 385 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
import logging
from datetime import datetime
from datetime import datetime, timezone
from pathlib import Path
from PIL import Image
from io import BytesIO
@@ -74,7 +74,7 @@ def store_attachment(file_bytes, original_filename, user_uid):
"directory": directory, "file_size": len(file_bytes), "mime_type": mime,
"image_width": img_w, "image_height": img_h,
"has_thumbnail": 1 if thumb else 0,
"created_at": datetime.utcnow().isoformat(),
"created_at": datetime.now(timezone.utc).isoformat(),
})
return {"uid": uid, "original_filename": original_filename, "file_size": len(file_bytes), "mime_type": mime, "url": f"/static/uploads/attachments/{directory}/{stored_name}", "thumbnail_url": f"/static/uploads/attachments/{directory}/{thumb}" if thumb else None, "has_thumbnail": thumb is not None, "is_image": is_img}