Exemple #1
0
 def template_renderer(self, content, vars, filename=None):
     """
     Subclasses may override this to provide different template
     substitution (e.g., use a different template engine).
     """
     if self.use_cheetah:
         import Cheetah.Template
         tmpl = Cheetah.Template.Template(content, searchList=[vars])
         return copydir.careful_sub(tmpl, vars, filename)
     else:
         tmpl = string.Template(content)
         return tmpl.substitute(vars)
    def template_renderer(self, content, vars, filename=None):
        """
        Subclasses may override this to provide different template
        substitution (e.g., use a different template engine).
        """
        if self.use_cheetah:
            import Cheetah.Template

            tmpl = Cheetah.Template.Template(content, searchList=[vars])
            return copydir.careful_sub(tmpl, vars, filename)
        else:
            tmpl = string.Template(content)
            return tmpl.substitute(vars)
Exemple #3
0
    def config_content(self, command, vars):
        """
        Called by ``self.write_config``, this returns the text content
        for the config file, given the provided variables.

        The default implementation reads
        ``Package.egg-info/paste_deploy_config.ini_tmpl`` and fills it
        with the variables.
        """
        global Cheetah
        meta_name = 'paste_deploy_config.ini_tmpl'
        if not self.dist.has_metadata(meta_name):
            if command.verbose:
                print 'No %s found' % meta_name
            return self.simple_config(vars)
        if self.use_cheetah:
            import Cheetah.Template
            tmpl = Cheetah.Template.Template(self.dist.get_metadata(meta_name),
                                             searchList=[vars])
            return copydir.careful_sub(tmpl, vars, meta_name)
        else:
            tmpl = string.Template(self.dist.get_metadata(meta_name))
            return tmpl.substitute(vars)
Exemple #4
0
    def config_content(self, command, vars):
        """
        Called by ``self.write_config``, this returns the text content
        for the config file, given the provided variables.

        The default implementation reads
        ``Package.egg-info/paste_deploy_config.ini_tmpl`` and fills it
        with the variables.
        """
        global Cheetah
        meta_name = 'paste_deploy_config.ini_tmpl'
        if not self.dist.has_metadata(meta_name):
            if command.verbose:
                print 'No %s found' % meta_name
            return self.simple_config(vars)
        if self.use_cheetah:
            import Cheetah.Template
            tmpl = Cheetah.Template.Template(self.dist.get_metadata(meta_name),
                                    searchList=[vars])
            return copydir.careful_sub(
                tmpl, vars, meta_name)
        else:
            tmpl = string.Template(self.dist.get_metadata(meta_name))
            return tmpl.substitute(vars)