-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
62 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
from sqlalchemy.exc import SQLAlchemyError | ||
|
||
from db_models import Config, db | ||
from db_models import Extension, db | ||
from helper import logging | ||
|
||
def get_extension_from_config(extension_name: str): | ||
try: | ||
extension = db.session.query(Config).filter(Config.extension_name == extension_name).first() | ||
extension = db.session.query(Extension).filter(Extension.extension_name == extension_name).first() | ||
if extension: return extension | ||
except SQLAlchemyError as e: | ||
logging(f"An error occurred while retrieving an extension from the config table: {e}") | ||
logging(f"An error occurred while retrieving an extension from the extension table: {e}") | ||
return False | ||
|
||
def get_extensions_from_config(): | ||
extensions = Config.query.all() | ||
def get_extensions_from_extensions(): | ||
extensions = Extension.query.all() | ||
if not extensions: return [] | ||
return extensions | ||
|
||
def get_extensions_info_from_config(): | ||
extensions = Config.query.all() | ||
def get_extensions_info_from_extensions(): | ||
extensions = Extension.query.all() | ||
if not extensions: return [] | ||
return [(extension.extension_name, extension.active) for extension in extensions] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters