There's a "mako.imports" template option for mako. In the times of
Myghty there was a setup that added additional "escapes" to Myghty in
config/environment.py, I ported it to Mako and use in my projects like
this:

tmpl_options['mako.imports'] = ['from webhelpers import auto_link as l',
                                    'from webhelpers import simple_format as s']

So I have a l and h filters in all my templates. You can use it for
importing other filters. :)

I hope it helps.

On 7/17/07, Scott Benjamin <[EMAIL PROTECTED]> wrote:
>
> Does that then mean that I must
>
> <%!
>    import myfilters
> %>
>
> in every template file?  Surely there is a way to put it in one
> inherited template?
>
> Scott
>
>
> On Jul 17, 6:08 am, jose <[EMAIL PROTECTED]> wrote:
> > I think this is what you need
> >
> > <%!
> >     import myfilters
> > %>
> >
> > Heres some tagged text: ${"text" | myfilters.tagfilter}
> >
> > Jose
> >
> > On Jul 14, 6:19 am, Scott Benjamin <[EMAIL PROTECTED]> wrote:
> >
> > > I'm using mako for my templating language and I noticed it has support
> > > for filters, but what I would like to do with it is have a file that
> > > contains all of my filters, and then just use them in the templates as
> > > needed.  Consolidating the template filters into one file seems
> > > simpler as I don't keep 50 copies  of the same filter in 50 templates.
> >
> > > Is what I'm after even possible with Mako? Maybe there is another
> > > solution that I haven't come up with.
> >
> > > Cheers,
> >
> > > Scott
>
>
> >
>


-- 
WBR, Dan Korostelev

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to