comparison libervia/server/server.py @ 1292:e30e96958fb7

server: use C.SITE_NAME_DEFAULT instead of "sat" when suitable
author Goffi <goffi@goffi.org>
date Fri, 19 Jun 2020 16:47:51 +0200
parents 1f26d8c2afc1
children de3b15d68bb6
comparison
equal deleted inserted replaced
1291:6daab90bfb8a 1292:e30e96958fb7
774 log.error(_("Can't get namespaces map: {msg}").format(msg=failure_)) 774 log.error(_("Can't get namespaces map: {msg}").format(msg=failure_))
775 775
776 @template.contextfilter 776 @template.contextfilter
777 def _front_url_filter(self, ctx, relative_url): 777 def _front_url_filter(self, ctx, relative_url):
778 template_data = ctx['template_data'] 778 template_data = ctx['template_data']
779 return os.path.join('/', C.TPL_RESOURCE, template_data.site or 'sat', 779 return os.path.join(
780 '/', C.TPL_RESOURCE, template_data.site or C.SITE_NAME_DEFAULT,
780 C.TEMPLATE_TPL_DIR, template_data.theme, relative_url) 781 C.TEMPLATE_TPL_DIR, template_data.theme, relative_url)
781 782
782 def _moveFirstLevelToDict(self, options, key, keys_to_keep): 783 def _moveFirstLevelToDict(self, options, key, keys_to_keep):
783 """Read a config option and put value at first level into u'' dict 784 """Read a config option and put value at first level into u'' dict
784 785
897 self.vhost_root.addHost(host_name.encode('utf-8'), res) 898 self.vhost_root.addHost(host_name.encode('utf-8'), res)
898 899
899 templates_res = web_resource.Resource() 900 templates_res = web_resource.Resource()
900 self.putChildAll(C.TPL_RESOURCE.encode('utf-8'), templates_res) 901 self.putChildAll(C.TPL_RESOURCE.encode('utf-8'), templates_res)
901 for site_name, site_path in self.renderer.sites_paths.items(): 902 for site_name, site_path in self.renderer.sites_paths.items():
902 templates_res.putChild(site_name.encode('utf-8') or b'sat', 903 templates_res.putChild(site_name.encode() or C.SITE_NAME_DEFAULT.encode(),
903 ProtectedFile(site_path)) 904 static.File(site_path))
904 905
905 d = self.bridgeCall("namespacesGet") 906 d = self.bridgeCall("namespacesGet")
906 d.addCallback(self._namespacesGetCb) 907 d.addCallback(self._namespacesGetCb)
907 d.addErrback(self._namespacesGetEb) 908 d.addErrback(self._namespacesGetEb)
908 909