Mercurial > libervia-web
diff libervia/server/tasks/implicit/task_brython.py @ 1282:0e4e413eb8db
server: user new OrderedSet to handle scripts:
OrderedSet is needed because scripts must not be duplicated and must be generated in right
order.
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 19 Jun 2020 16:47:51 +0200 |
parents | 2d1ceb026d0e |
children | 089742e065e3 |
line wrap: on
line diff
--- a/libervia/server/tasks/implicit/task_brython.py Fri Jun 19 16:47:50 2020 +0200 +++ b/libervia/server/tasks/implicit/task_brython.py Fri Jun 19 16:47:51 2020 +0200 @@ -7,6 +7,7 @@ from sat.core.i18n import _ from sat.core.log import getLogger from sat.core import exceptions +from sat.tools.common import utils from libervia.server.constants import Const as C from libervia.server.classes import Script from libervia.server.tasks import task @@ -62,10 +63,10 @@ for dyn_data in self.resource.browser_modules["brython"]: url_hash = dyn_data['url_hash'] import_url = f"/{C.BUILD_DIR}/{C.BUILD_DIR_DYN}/{url_hash}" - dyn_data.setdefault('scripts', set()).update({ + dyn_data.setdefault('scripts', utils.OrderedSet()).update([ Script(src=f"/{C.BUILD_DIR}/brython.js"), Script(src=f"/{C.BUILD_DIR}/brython_stdlib.js"), - }) + ]) dyn_data.setdefault('template', {})['body_onload'] = self.getBodyOnload( extra_path=[import_url]) self.WATCH_DIRS.append(dyn_data['path'].resolve()) @@ -108,10 +109,10 @@ init_file = dyn_data['path'] / '__init__.py' if init_file.is_file(): - self.resource.dyn_data_common['scripts'].update({ + self.resource.dyn_data_common['scripts'].update([ Script(src=f"/{C.BUILD_DIR}/brython.js"), Script(type='text/python', src=init_dest_url) - }) + ]) self.resource.dyn_data_common.setdefault( "template", {})['body_onload'] = self.getBodyOnload() else: