Commit
·
a7ddf76
1
Parent(s):
96a6d41
Fix MongoDB database boolean check - use 'is None' instead of truthiness
Browse files- app/database.py +3 -3
- app/main.py +1 -1
- app/main_fastai.py +1 -1
- app/main_sdxl.py +1 -1
app/database.py
CHANGED
|
@@ -76,7 +76,7 @@ def log_api_call(
|
|
| 76 |
"""
|
| 77 |
try:
|
| 78 |
db = get_database()
|
| 79 |
-
if
|
| 80 |
logger.warning("MongoDB not available, skipping API log")
|
| 81 |
return False
|
| 82 |
|
|
@@ -125,7 +125,7 @@ def log_image_upload(
|
|
| 125 |
"""
|
| 126 |
try:
|
| 127 |
db = get_database()
|
| 128 |
-
if
|
| 129 |
logger.warning("MongoDB not available, skipping upload log")
|
| 130 |
return False
|
| 131 |
|
|
@@ -174,7 +174,7 @@ def log_colorization(
|
|
| 174 |
"""
|
| 175 |
try:
|
| 176 |
db = get_database()
|
| 177 |
-
if
|
| 178 |
logger.warning("MongoDB not available, skipping colorization log")
|
| 179 |
return False
|
| 180 |
|
|
|
|
| 76 |
"""
|
| 77 |
try:
|
| 78 |
db = get_database()
|
| 79 |
+
if db is None:
|
| 80 |
logger.warning("MongoDB not available, skipping API log")
|
| 81 |
return False
|
| 82 |
|
|
|
|
| 125 |
"""
|
| 126 |
try:
|
| 127 |
db = get_database()
|
| 128 |
+
if db is None:
|
| 129 |
logger.warning("MongoDB not available, skipping upload log")
|
| 130 |
return False
|
| 131 |
|
|
|
|
| 174 |
"""
|
| 175 |
try:
|
| 176 |
db = get_database()
|
| 177 |
+
if db is None:
|
| 178 |
logger.warning("MongoDB not available, skipping colorization log")
|
| 179 |
return False
|
| 180 |
|
app/main.py
CHANGED
|
@@ -77,7 +77,7 @@ async def startup_event():
|
|
| 77 |
"""Initialize MongoDB on startup"""
|
| 78 |
try:
|
| 79 |
db = get_database()
|
| 80 |
-
if db:
|
| 81 |
print("✅ MongoDB initialized successfully!")
|
| 82 |
except Exception as e:
|
| 83 |
print(f"⚠️ MongoDB initialization failed: {e}")
|
|
|
|
| 77 |
"""Initialize MongoDB on startup"""
|
| 78 |
try:
|
| 79 |
db = get_database()
|
| 80 |
+
if db is not None:
|
| 81 |
print("✅ MongoDB initialized successfully!")
|
| 82 |
except Exception as e:
|
| 83 |
print(f"⚠️ MongoDB initialization failed: {e}")
|
app/main_fastai.py
CHANGED
|
@@ -110,7 +110,7 @@ async def startup_event():
|
|
| 110 |
# Initialize MongoDB
|
| 111 |
try:
|
| 112 |
db = get_database()
|
| 113 |
-
if db:
|
| 114 |
logger.info("✅ MongoDB initialized successfully!")
|
| 115 |
except Exception as e:
|
| 116 |
logger.warning("⚠️ MongoDB initialization failed: %s", str(e))
|
|
|
|
| 110 |
# Initialize MongoDB
|
| 111 |
try:
|
| 112 |
db = get_database()
|
| 113 |
+
if db is not None:
|
| 114 |
logger.info("✅ MongoDB initialized successfully!")
|
| 115 |
except Exception as e:
|
| 116 |
logger.warning("⚠️ MongoDB initialization failed: %s", str(e))
|
app/main_sdxl.py
CHANGED
|
@@ -188,7 +188,7 @@ async def startup_event():
|
|
| 188 |
# Initialize MongoDB
|
| 189 |
try:
|
| 190 |
db = get_database()
|
| 191 |
-
if db:
|
| 192 |
logger.info("✅ MongoDB initialized successfully!")
|
| 193 |
except Exception as e:
|
| 194 |
logger.warning("⚠️ MongoDB initialization failed: %s", str(e))
|
|
|
|
| 188 |
# Initialize MongoDB
|
| 189 |
try:
|
| 190 |
db = get_database()
|
| 191 |
+
if db is not None:
|
| 192 |
logger.info("✅ MongoDB initialized successfully!")
|
| 193 |
except Exception as e:
|
| 194 |
logger.warning("⚠️ MongoDB initialization failed: %s", str(e))
|