Skip to content

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 pull request Jan 14, 2016
wardi added a commit to wardi/ckan that referenced this pull request Jan 14, 2016
wardi added a commit to wardi/ckan that referenced this pull request 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 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 Compare January 15, 2016 18:06
@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 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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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
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.

2 participants