[ckan-dev] ITemplateHelpers

Toby Dacre toby.okfn at gmail.com
Tue Apr 17 14:24:51 UTC 2012


Ok,

This in now in master

class ITemplateHelpers(Interface):
    """
    Allow adding extra template functions available via h variable
    """
    def get_helpers(self):
        """
        Should return a dict, the keys being the name of the helper
        function and the values being the functions themselves.
        """

It seems that these functions will end up in lib/helpers.py after all.  In
the current implementation you can override existing helpers but not
override other plugin created helpers.

Toby


On 17 April 2012 14:43, John Glover <john.glover at okfn.org> wrote:

> Sounds good to me.
>
> John
>
> 2012/4/17 Adrià Mercader <amercadero at gmail.com>:
> > +1
> >
> > On 17 April 2012 15:20, Ross Jones <ross.jones at okfn.org> wrote:
> >> Yes please, that'd be really really useful :)
> >>
> >> On 17 Apr 2012, at 14:18, Toby Dacre wrote:
> >>
> >>> I'd like to add a new ITemplateHelpers plugin interface to allow
> plugins to register new template helper functions.
> >>>
> >>> I think this would be helpful in reducing the need to have python code
> in templates which is good for both readability and customisation of
> templates.  It would work in a similar way to the IActions interface. The
> functions would be available via h in templates but not via lib/helpers.py
> >>>
> >>> Does this seem a reasonable thing to be doing?
> >>>
> >>> Toby
> >>> _______________________________________________
> >>> ckan-dev mailing list
> >>> ckan-dev at lists.okfn.org
> >>> http://lists.okfn.org/mailman/listinfo/ckan-dev
> >>
> >>
> >> _______________________________________________
> >> ckan-dev mailing list
> >> ckan-dev at lists.okfn.org
> >> http://lists.okfn.org/mailman/listinfo/ckan-dev
> >
> > _______________________________________________
> > ckan-dev mailing list
> > ckan-dev at lists.okfn.org
> > http://lists.okfn.org/mailman/listinfo/ckan-dev
>
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> http://lists.okfn.org/mailman/listinfo/ckan-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20120417/667f7cb8/attachment-0001.html>


More information about the ckan-dev mailing list