예제 #1
0
파일: engine.py 프로젝트: troyscott/hyde
 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)
예제 #2
0
 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)
예제 #3
0
파일: engine.py 프로젝트: chewable/hyde
 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)
예제 #4
0
파일: engine.py 프로젝트: semk/hyde
 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)
예제 #5
0
 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
예제 #6
0
파일: engine.py 프로젝트: mnemnosi/hyde
    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)