Self hosted FLOSS fitness/workout, nutrition and weight tracker
Check for server version
Roland Geiderb81866f133c8
diff --git a/wger/nutrition/tasks.py b/wger/nutrition/tasks.pyindex 5a92d9f2e..88af4fdfa 100644--- a/wger/nutrition/tasks.py+++ b/wger/nutrition/tasks.py@@ -20,6 +20,7 @@ from random import randintfrom django.conf import settingsfrom django.core.cache import cachefrom django.core.management import call_command+from django.core.management.base import CommandError# Third Partyimport requests@@ -28,6 +29,7 @@ from celery.schedules import crontab# wgerfrom wger.celery_configuration import app+from wger.core.api.min_server_version import check_min_server_versionfrom wger.nutrition.api.endpoints import INGREDIENTS_ENDPOINTfrom wger.nutrition.sync import (download_ingredient_dump,@@ -152,6 +154,12 @@ def sync_ingredients_bulk_or_api_task():(e.g. the remote server hasn't generated one), falls back to the paginatedAPI sync."""+ try:+ check_min_server_version(settings.WGER_SETTINGS['WGER_INSTANCE'])+ except CommandError as e:+ logger.error(f'Ingredient sync aborted, server incompatible: {e}')+ return+try:file_path = download_ingredient_dump(logger.info)try: