def make_site(self, sitepath, config, deploy=None): """ Creates a site object from the given sitepath and the config file. """ config = Config(sitepath, config_file=config) if deploy: config.deploy_root = deploy return Site(sitepath, config)
def make_site(self, sitepath, config, deploy): """ Creates a site object from the given sitepath and the config file. """ sitepath = Folder(Folder(sitepath).fully_expanded_path) config = Config(sitepath, config_file=config) if deploy: config.deploy_root = deploy return Site(sitepath, config)
def make_site(self, sitepath, config, deploy=None): """ Creates a site object from the given sitepath and the config file. """ sitepath = Folder(Folder(sitepath).fully_expanded_path) config = Config(sitepath, config_file=config) if deploy: config.deploy_root = deploy return Site(sitepath, config)
def make_site(self, sitepath, config, deploy=None): """ Creates a site object from the given sitepath and the config file. """ config = Config(sitepath, config_file=config) config.deploy_root = deploy or Path(sitepath) / "deploy_gopher" site = Site(sitepath, config) site.context['site'] = site site.config.layout_root = getattr( site.config, "gopher_layout_root", "layout_gopher" ) site.config.gopher_width = getattr(site.config, "gopher_width", 70) return site
def make_site(self, sitepath, config, deploy=None, overrides=None): """ Creates a site object from the given sitepath and the config file. """ sitepath = Folder(Folder(sitepath).fully_expanded_path) config = Config(sitepath, config_file=config) if deploy: config.deploy_root = deploy if overrides: for override in overrides: key, value = (x.strip() for x in override.split("=", 1)) logger.info("overriding %s to: %s" % (key, value)) try: target = config path = key.split('.') if len(path) == 1: target.set_expando(key, value) else: for name in path[:-1]: idx = None if "#" in name: name, idx = name.split("#", 1) target = getattr(target, name) if idx: target = target[int(idx)] target.set_expando(path[-1], value) except (AttributeError, TypeError, IndexError): logger.error("unable to resolve override of %r" % (key,)) return Site(sitepath, config)