okfn/ckan — pull request #18 by tobes (2012-06-01 14:57:39+00:00)
Title: DO NOT MERGE THIS BRANCH: Experimental lazy properties

This is a proposed patch that would allow us to start the process of moving some stuff that is currently done in controllers out into helper functions. The best example I am aware of is the the ckan index page currently renders an activity stream that is not used on the datahub.

by changing from

c.var = do_lots_of_work()

to

@property
def wrapper_function():
return do_lots_of_work()

c.var = wrapper_function

we make the function only get called if needed. Following this it is also easy to replace the call with that to a helper function and eventually deprecate the wrapper function / template variable

This does need us to patch genshi but as we are using a pyenv and needing a specific version it should hopefully be safe. I cannot see how else we can easily move away from work done in controllers to work done in helpers which feels the better approach for stability etc.

If we are happy with this then I'd like to see it or one similar in ckan 1.8