Skip to content

Commit 0150f93

Browse files
committed
Fix inability to import settings backup
1 parent 8080304 commit 0150f93

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
### Features
44

5+
- Fix inability to import settings backup
56
- Add ability to use Actions in Custom Functions
67
- Add Input Action: Execute Python 3 Code ([#1334](https://github.com/kizniche/Mycodo/issues/1334))
78
- Add Function: Adafruit Neokey (Key Press Executes Actions) ([#1353](https://github.com/kizniche/Mycodo/issues/1353))

mycodo/mycodo_flask/utils/utils_export.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,17 @@
1010
import zipfile
1111

1212
from flask import send_file, url_for
13+
from packaging.version import parse
1314
from werkzeug.utils import secure_filename
1415

15-
from mycodo.config import (ALEMBIC_VERSION, DATABASE_NAME, DEPENDENCY_LOG_FILE,
16-
DOCKER_CONTAINER, IMPORT_LOG_FILE,
16+
from mycodo.config import (ALEMBIC_VERSION, DATABASE_NAME, DOCKER_CONTAINER, IMPORT_LOG_FILE,
1717
INSTALL_DIRECTORY, MYCODO_VERSION,
1818
PATH_ACTIONS_CUSTOM, PATH_FUNCTIONS_CUSTOM,
1919
PATH_HTML_USER, PATH_INPUTS_CUSTOM,
2020
PATH_OUTPUTS_CUSTOM, PATH_PYTHON_CODE_USER,
2121
PATH_USER_SCRIPTS, PATH_WIDGETS_CUSTOM,
2222
SQL_DATABASE_MYCODO)
2323
from mycodo.config_translations import TRANSLATIONS
24-
from mycodo.databases.models import Misc
2524
from mycodo.mycodo_flask.utils.utils_general import (flash_form_errors,
2625
flash_success_errors)
2726
from mycodo.scripts.measurement_db import get_influxdb_info
@@ -240,10 +239,10 @@ def import_settings(form):
240239
error.append(f"Correct format is: {correct_format}")
241240
elif extension != correct_extension:
242241
error.append("Extension not 'zip'")
243-
elif name_split[1] > MYCODO_VERSION:
242+
elif parse(name_split[1]) > parse(MYCODO_VERSION):
244243
error.append(
245244
f"Invalid Mycodo version: {name_split[1]} > {MYCODO_VERSION}. "
246-
f"Only databases <= {name_split[1]} can only be imported")
245+
f"Only databases <= {name_split[1]} can be imported")
247246
except Exception as err:
248247
error.append(f"Exception while verifying file name: {err}")
249248

0 commit comments

Comments
 (0)