Skip to content

Commit

Permalink
Fix inability to import settings backup
Browse files Browse the repository at this point in the history
  • Loading branch information
kizniche committed Dec 13, 2023
1 parent 8080304 commit 0150f93
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

### Features

- Fix inability to import settings backup
- Add ability to use Actions in Custom Functions
- Add Input Action: Execute Python 3 Code ([#1334](https://github.com/kizniche/Mycodo/issues/1334))
- Add Function: Adafruit Neokey (Key Press Executes Actions) ([#1353](https://github.com/kizniche/Mycodo/issues/1353))
Expand Down
9 changes: 4 additions & 5 deletions mycodo/mycodo_flask/utils/utils_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,17 @@
import zipfile

from flask import send_file, url_for
from packaging.version import parse
from werkzeug.utils import secure_filename

from mycodo.config import (ALEMBIC_VERSION, DATABASE_NAME, DEPENDENCY_LOG_FILE,
DOCKER_CONTAINER, IMPORT_LOG_FILE,
from mycodo.config import (ALEMBIC_VERSION, DATABASE_NAME, DOCKER_CONTAINER, IMPORT_LOG_FILE,
INSTALL_DIRECTORY, MYCODO_VERSION,
PATH_ACTIONS_CUSTOM, PATH_FUNCTIONS_CUSTOM,
PATH_HTML_USER, PATH_INPUTS_CUSTOM,
PATH_OUTPUTS_CUSTOM, PATH_PYTHON_CODE_USER,
PATH_USER_SCRIPTS, PATH_WIDGETS_CUSTOM,
SQL_DATABASE_MYCODO)
from mycodo.config_translations import TRANSLATIONS
from mycodo.databases.models import Misc
from mycodo.mycodo_flask.utils.utils_general import (flash_form_errors,
flash_success_errors)
from mycodo.scripts.measurement_db import get_influxdb_info
Expand Down Expand Up @@ -240,10 +239,10 @@ def import_settings(form):
error.append(f"Correct format is: {correct_format}")
elif extension != correct_extension:
error.append("Extension not 'zip'")
elif name_split[1] > MYCODO_VERSION:
elif parse(name_split[1]) > parse(MYCODO_VERSION):
error.append(
f"Invalid Mycodo version: {name_split[1]} > {MYCODO_VERSION}. "
f"Only databases <= {name_split[1]} can only be imported")
f"Only databases <= {name_split[1]} can be imported")
except Exception as err:
error.append(f"Exception while verifying file name: {err}")

Expand Down

0 comments on commit 0150f93

Please sign in to comment.