Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimental lazy properties #18

Closed
wants to merge 4 commits into from
Closed

Conversation

tobes
Copy link
Contributor

@tobes tobes commented Jun 1, 2012

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

@kindly kindly closed this Jun 19, 2012
wardi added a commit to wardi/ckan that referenced this pull request May 29, 2013
fix for package_list returning nested list
@amercader amercader deleted the experimental-lazy-properties branch March 4, 2015 13:18
benjaminleighton added a commit to CSIRO-enviro-informatics/ckan that referenced this pull request Nov 29, 2018
…mc to damc

* commit '9236c2c0d2b32439be83221fef77e5254e437509':
  Ensure a failing psql command does not bring down the ckan-entrypoint.sh process.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants