comparison libervia/server/pages.py @ 1318:38875bc292ff

pages: add `media_path` and `build_path` in template data for error pages.
author Goffi <goffi@goffi.org>
date Sat, 01 Aug 2020 16:47:24 +0200
parents a7ab4d244982
children 6e2821e78489
comparison
equal deleted inserted replaced
1317:a7ab4d244982 1318:38875bc292ff
1290 template_data['site'] = self.vhost_root.site_name 1290 template_data['site'] = self.vhost_root.site_name
1291 1291
1292 rendered = self.host.renderer.render( 1292 rendered = self.host.renderer.render(
1293 template, 1293 template,
1294 theme=session_data.theme or self.default_theme, 1294 theme=session_data.theme or self.default_theme,
1295 media_path=f"/{C.MEDIA_DIR}",
1296 build_path=f"/{C.BUILD_DIR}/",
1295 site_themes=self.site_themes, 1297 site_themes=self.site_themes,
1296 error_code=code, 1298 error_code=code,
1297 **template_data 1299 **template_data
1298 ) 1300 )
1299 1301
1404 self.template, 1406 self.template,
1405 theme=theme, 1407 theme=theme,
1406 site_themes=self.site_themes, 1408 site_themes=self.site_themes,
1407 page_url=self.getURL(), 1409 page_url=self.getURL(),
1408 media_path=f"/{C.MEDIA_DIR}", 1410 media_path=f"/{C.MEDIA_DIR}",
1411 build_path=f"/{C.BUILD_DIR}/",
1409 cache_path=session_data.cache_dir, 1412 cache_path=session_data.cache_dir,
1410 build_path=f"/{C.BUILD_DIR}/",
1411 main_menu=self.main_menu, 1413 main_menu=self.main_menu,
1412 **template_data) 1414 **template_data)
1413 1415
1414 def _on_data_post_redirect(self, ret, request): 1416 def _on_data_post_redirect(self, ret, request):
1415 """called when page's on_data_post has been done successfuly 1417 """called when page's on_data_post has been done successfuly
1623 return self.host.renderer.render( 1625 return self.host.renderer.render(
1624 template, 1626 template,
1625 theme=session_data.theme or self.default_theme, 1627 theme=session_data.theme or self.default_theme,
1626 site_themes=self.site_themes, 1628 site_themes=self.site_themes,
1627 page_url=self.getURL(), 1629 page_url=self.getURL(),
1628 media_path="/" + C.MEDIA_DIR, 1630 media_path=f"/{C.MEDIA_DIR}",
1631 build_path=f"/{C.BUILD_DIR}/",
1629 cache_path=session_data.cache_dir, 1632 cache_path=session_data.cache_dir,
1630 build_path="/" + C.BUILD_DIR + "/",
1631 main_menu=self.main_menu, 1633 main_menu=self.main_menu,
1632 **template_data 1634 **template_data
1633 ) 1635 )
1634 1636
1635 def renderAndUpdate( 1637 def renderAndUpdate(