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

toolkit: add h, StopOnError, DefaultOrganizationForm #2835

Merged
merged 6 commits into from Jan 22, 2016

Conversation

@wardi
Copy link
Contributor

@wardi wardi commented Jan 14, 2016

These changes will let me remove all deep ckan imports from ckanext-scheming.

For h I've chosen to export the same object that the templates see (with all the same side-effects) I think that's better than just exporting ckan.lib.helpers but I would kind of like to have proper AttributeErrors when I mistype a helper name.

wardi added a commit to wardi/ckan that referenced this issue Jan 14, 2016
wardi added a commit to wardi/ckan that referenced this issue Jan 14, 2016
wardi added a commit to wardi/ckan that referenced this issue Jan 14, 2016
@wardi wardi changed the title toolkit: add test_helpers, test_factories toolkit: add test_helpers, test_factories, StopOnError Jan 14, 2016
@wardi wardi added the WIP label Jan 14, 2016
@wardi
Copy link
Contributor Author

@wardi wardi commented Jan 14, 2016

sadly, this doesn't let me import ckan.plugins.toolkit.test_helpers as helpers yet. Need to dig further

@wardi wardi force-pushed the 2835-toolkit-test-helpers-factories branch from ed74b50 to cc0bb58 Jan 15, 2016
@wardi wardi changed the title toolkit: add test_helpers, test_factories, StopOnError toolkit: add StopOnError Jan 15, 2016
@wardi wardi removed the WIP label Jan 15, 2016
@wardi wardi changed the title toolkit: add StopOnError toolkit: add h, StopOnError, DefaultOrganizationForm Jan 15, 2016
@wardi wardi added the WIP label Jan 19, 2016
@wardi wardi removed the WIP label Jan 19, 2016
@wardi
Copy link
Contributor Author

@wardi wardi commented Jan 19, 2016

This now has proper AttributeErrors for missing helpers on toolkit.h (unlike h in templates)

As a bonus we can now use h.no_magic.myhelper instead of h.myhelper in templates if we want an exception when this helper does not exist.

@brew brew self-assigned this Jan 21, 2016
''' This function is returned if no helper is found. The idea is
to try to allow templates to be rendered even if helpers are
missing. Returning the empty string seems to work well.'''
return ''
Copy link
Contributor Author

@wardi wardi Jan 21, 2016

@brew I moved this out because there's no reason for it to be a classmethod (it never uses cls), and because as a normal function I can do the is _null_function check below

@brew brew merged commit 6ceadf5 into ckan:master Jan 22, 2016
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants