[ckan-dev] cleaning helpers

Ross Jones ross.jones at okfn.org
Wed Mar 28 10:44:25 UTC 2012


Hi Toby,

That's great, definitely worth doing.  Might it be worth setting a timescale for the changes? i.e. try and get them cleaned up for 1.6.2 rather than it dragging out? 

Whilst you're fixing up the stuff in lib/ I don't support there is any chance of you fixing up render() and splitting it out into render() and render_text() as currently whenever I want to use a text template I need to mess about with genshi loader classes in an extension, and that's nasty.

Ross.

On 28 Mar 2012, at 11:36, Toby Dacre wrote:

> Hi,
> 
> I've been doing some cleanups to remove unused functions from h passed to templates.
> 
> There is now a new config option `ckan.restrict_template_vars` if this is set it will only allow a restricted set of functions.  Also functions that required c to be passed eg h.nav_link() no longer accept this and should be called without c as a parameter (will raise an exception).
> 
> If not set then we are all as usual and functions like nav_link() can be called with or without c being passed.
> 
> This means we can start transitioning to a cleaner setup without breaking existing templates etc but we can also test the strict new rules.
> 
> the allowed functions are in lib/helpers_clean.py (and yes I have done a from ... import ...) I would like to see us transition to forcing using cleaner template vars as soon as practical.
> 
> this is merged into master
> 
> cheers
> Toby
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> http://lists.okfn.org/mailman/listinfo/ckan-dev





More information about the ckan-dev mailing list