Ian Bicking <[EMAIL PROTECTED]> writes:
> For make-config (and setup-app) it'll look up an installer class.
> Lots of people use the Pylons default class, or
> paste.script.appinstall.Installer, which is also pretty generic.
Thanks for all the pointers. The Pylons default class is a bit
minimalist. I guess I could use Cheetah to do the filling that I want
but since I already need Mako for my app, using it is logical choice.
Here is my Installer:
from paste.script.appinstall import Installer
from mako.template import Template
from paste.script import copydir
class MakoInstaller(Installer):
use_cheetah = False
meta_name = "paste_deploy_config.ini_tmpl"
def config_content(self, command, vars):
"""
Called by ``self.write_config``, this returns the text content
for the config file, given the provided variables.
This implementation reads
``Package.egg-info/paste_deploy_config.ini_tmpl`` and fills it
with the variables using Mako.
"""
global Cheetah
if not self.dist.has_metadata(self.meta_name):
if command.verbose:
print 'No %s found' % meta_name
return self.simple_config(vars)
tmpl = Template(self.dist.get_metadata(self.meta_name))
return copydir.careful_sub(
tmpl.render_unicode(**vars), vars, self.meta_name)
I'm sure others would have a use for that. Would you merge it Paste?
Well, I guess I could make appinstall.Installer accept a Mako option
instead of sub-classing.
Anyway, my problem is solved. Thanks for your help.
--
Yannick Gingras
_______________________________________________
Paste-users mailing list
[email protected]
http://webwareforpython.org/cgi-bin/mailman/listinfo/paste-users