Merge branch 'main' into storefront-nuxt
This commit is contained in:
commit
90bd5066c8
4 changed files with 24 additions and 7 deletions
|
|
@ -23,9 +23,15 @@ logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@shared_task(queue="default")
|
@shared_task(queue="default")
|
||||||
def backup_task():
|
def backup_task() -> tuple[bool, str]:
|
||||||
|
backups: list[str] = []
|
||||||
|
if config.BACKUP_DATABASE:
|
||||||
call_command("dbbackup", clean=True)
|
call_command("dbbackup", clean=True)
|
||||||
|
backups.append("database")
|
||||||
|
if config.BACKUP_MEDIA:
|
||||||
call_command("mediabackup", clean=True)
|
call_command("mediabackup", clean=True)
|
||||||
|
backups.append("media")
|
||||||
|
return True, f"Successfully backed up {', '.join(backups)}"
|
||||||
|
|
||||||
|
|
||||||
@shared_task(queue="stock_updater")
|
@shared_task(queue="stock_updater")
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,8 @@ def get_vendors_integrations(name: str | None = None) -> list[AbstractVendor]:
|
||||||
module_name, class_name = vendor.integration_path.rsplit(".", 1) # type: ignore [union-attr]
|
module_name, class_name = vendor.integration_path.rsplit(".", 1) # type: ignore [union-attr]
|
||||||
vendors_integrations.append(create_object(module_name, class_name))
|
vendors_integrations.append(create_object(module_name, class_name))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning("Couldn't load integration for vendor %s: %s", vendor.name, e)
|
logger.warning(
|
||||||
|
"Couldn't load integration %s for vendor %s: %s", vendor.integration_path, vendor.name, str(e)
|
||||||
|
)
|
||||||
|
|
||||||
return vendors_integrations
|
return vendors_integrations
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,10 @@ def validate_category_image_dimensions(
|
||||||
max_height = max_height or 4320
|
max_height = max_height or 4320
|
||||||
|
|
||||||
if image:
|
if image:
|
||||||
|
try:
|
||||||
width, height = get_image_dimensions(image.file) # type: ignore [arg-type]
|
width, height = get_image_dimensions(image.file) # type: ignore [arg-type]
|
||||||
|
except (FileNotFoundError, OSError, ValueError):
|
||||||
|
return
|
||||||
|
|
||||||
if int(width) > max_width or int(height) > max_height: # type: ignore [arg-type]
|
if int(width) > max_width or int(height) > max_height: # type: ignore [arg-type]
|
||||||
raise ValidationError(_(f"image dimensions should not exceed w{max_width} x h{max_height} pixels"))
|
raise ValidationError(_(f"image dimensions should not exceed w{max_width} x h{max_height} pixels"))
|
||||||
|
|
|
||||||
|
|
@ -47,8 +47,10 @@ CONSTANCE_CONFIG = OrderedDict(
|
||||||
### SEO Options ###
|
### SEO Options ###
|
||||||
("ADVERTSIMENT", (getenv("EVIBES_ADVERTISIMENT", ""), _("An entity for storing advertisiment data"), "json")),
|
("ADVERTSIMENT", (getenv("EVIBES_ADVERTISIMENT", ""), _("An entity for storing advertisiment data"), "json")),
|
||||||
("ANALYTICS", (getenv("EVIBES_ANALYTICS", ""), _("An entity for storing analytics data"), "json")),
|
("ANALYTICS", (getenv("EVIBES_ANALYTICS", ""), _("An entity for storing analytics data"), "json")),
|
||||||
### Debugging Options ###
|
### System Options ###
|
||||||
("SAVE_VENDORS_RESPONSES", (False, _("Save responses from vendors' APIs"))),
|
("SAVE_VENDORS_RESPONSES", (False, _("Save responses from vendors' APIs"))),
|
||||||
|
("BACKUP_DATABASE", (True, _("Backup database"))),
|
||||||
|
("BACKUP_MEDIA", (False, _("Backup media"))),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -85,7 +87,11 @@ CONSTANCE_CONFIG_FIELDSETS = OrderedDict(
|
||||||
"ADVERTSIMENT",
|
"ADVERTSIMENT",
|
||||||
"ANALYTICS",
|
"ANALYTICS",
|
||||||
),
|
),
|
||||||
_("Debugging Options"): ("SAVE_VENDORS_RESPONSES",),
|
_("System Options"): (
|
||||||
|
"SAVE_VENDORS_RESPONSES",
|
||||||
|
"BACKUP_DATABASE",
|
||||||
|
"BACKUP_MEDIA",
|
||||||
|
),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue