mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
quality: use _assert_is_installed for consistency instead of if not _is_intalled(app): raise
This commit is contained in:
parent
c14ebc8be4
commit
c409888a4b
1 changed files with 2 additions and 18 deletions
20
src/app.py
20
src/app.py
|
@ -328,10 +328,7 @@ def app_map(app=None, raw=False, user=None):
|
||||||
result = {}
|
result = {}
|
||||||
|
|
||||||
if app is not None:
|
if app is not None:
|
||||||
if not _is_installed(app):
|
_assert_is_installed(app)
|
||||||
raise YunohostValidationError(
|
|
||||||
"app_not_installed", app=app, all_apps=_get_all_installed_apps_id()
|
|
||||||
)
|
|
||||||
apps = [
|
apps = [
|
||||||
app,
|
app,
|
||||||
]
|
]
|
||||||
|
@ -1424,10 +1421,7 @@ def app_remove(operation_logger, app, purge=False, force_workdir=None):
|
||||||
)
|
)
|
||||||
from yunohost.domain import domain_list, domain_config_get, domain_config_set
|
from yunohost.domain import domain_list, domain_config_get, domain_config_set
|
||||||
|
|
||||||
if not _is_installed(app):
|
_assert_is_installed(app)
|
||||||
raise YunohostValidationError(
|
|
||||||
"app_not_installed", app=app, all_apps=_get_all_installed_apps_id()
|
|
||||||
)
|
|
||||||
|
|
||||||
operation_logger.start()
|
operation_logger.start()
|
||||||
|
|
||||||
|
@ -2728,16 +2722,6 @@ def _list_upgradable_apps():
|
||||||
|
|
||||||
|
|
||||||
def _is_installed(app: str) -> bool:
|
def _is_installed(app: str) -> bool:
|
||||||
"""
|
|
||||||
Check if application is installed
|
|
||||||
|
|
||||||
Keyword arguments:
|
|
||||||
app -- id of App to check
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
Boolean
|
|
||||||
|
|
||||||
"""
|
|
||||||
return os.path.isdir(APPS_SETTING_PATH + app)
|
return os.path.isdir(APPS_SETTING_PATH + app)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue