comparison libervia/server/server.py @ 1268:e628724530ec

pages, tasks (brython): use set for scripts + common template data: - scripts are put in a set using a namedtuple, this way duplicates can be avoided easily - if `template` is set in dyn_data_common, items there are set in template data if they don't already exist - (brython): common template data is used to set body_onload when there is a root brython script and no page script
author Goffi <goffi@goffi.org>
date Tue, 19 May 2020 11:05:40 +0200
parents 6b7f9c3558cc
children eb4f03da0d7d
comparison
equal deleted inserted replaced
1267:b5f920845d34 1268:e628724530ec
188 self.site_path = Path(site_path) 188 self.site_path = Path(site_path)
189 self.site_themes = set() 189 self.site_themes = set()
190 self.named_pages = {} 190 self.named_pages = {}
191 self.browser_modules = {} 191 self.browser_modules = {}
192 # template dynamic data used in all pages 192 # template dynamic data used in all pages
193 self.dyn_data_common = {"scripts": []} 193 self.dyn_data_common = {"scripts": set()}
194 for theme, data in host.renderer.getThemesData(site_name).items(): 194 for theme, data in host.renderer.getThemesData(site_name).items():
195 # we check themes for browser metadata, and merge them here if found 195 # we check themes for browser metadata, and merge them here if found
196 self.site_themes.add(theme) 196 self.site_themes.add(theme)
197 browser_meta = data.get('browser_meta') 197 browser_meta = data.get('browser_meta')
198 if browser_meta is not None: 198 if browser_meta is not None: