Factorize a bit init_main_permission warning

Co-authored-by: Alexandre Aubin <alex.aubin@mailoo.org>
This commit is contained in:
tituspijean 2023-08-18 19:08:19 +02:00 committed by GitHub
parent cf82d0a46b
commit eb518e84e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1974,10 +1974,11 @@ class Manifest(TestSuite):
"When using a postgresql database, you should add postgresql in apt dependencies."
)
main_perm = self.manifest["resources"].get('permissions', {}).get('main', {})
if (
isinstance(self.manifest["resources"].get('permissions', {}).get('main', {}).get('url'), str)
isinstance(main_perm.get('url'), str)
and "init_main_permission" not in self.manifest['install']
and not isinstance(self.manifest["resources"].get('permissions', {}).get('main', {}).get('allowed'), str)
and not isinstance(main_perm.get('allowed'), str)
):
yield Warning(
"You should add a 'init_main_permission' question, or define `allowed` for main permission to have the app ready to be accessed right after installation."