[ckan-dev] ckan 2.2 issue (seems like)
Vitor Baptista
vitor at vitorbaptista.com
Thu May 8 18:17:59 UTC 2014
Hi Pabitra,
You shouldn't be calling the action functions directly, because another
plugin might modify them. Try getting them through get_action() and see if
it solves your problem.
Cheers,
2014-05-08 13:19 GMT-03:00 Pabitra Dash <pkdash_reena at hotmail.com>:
> Hi Everyone,
>
> It seems now there is no way to call an action function directly in ckan
> 2.2. One has to use get_action() method. That is perhaps causing the
> infinite loop issue for me where I am overriding a ckan action function. I
> see the following new piece of code in logic __inti__.py which forces to
> use get_action() method to use a action function.
>
> def replaced_action(action_name):
> def warn(context, data_dict):
> log.critical('Action `%s` is being called directly '
> 'all action calls should be accessed via '
> 'logic.get_action' % action_name)
> *return get_action(action_name)(context, data_dict)*
> return warn
>
> If I can't resolve this issue I have to roll back to ckan 2.1.
>
> Would very much appreciate some help on this.
>
> Thanks,
> Pabitra
>
>
>
>
>
> ------------------------------
> From: pkdash_reena at hotmail.com
> To: ckan-dev at lists.okfn.org
> Date: Wed, 7 May 2014 23:15:45 -0500
>
> Subject: Re: [ckan-dev] ckan 2.2 issue (seems like)
>
> Ian,
>
> I am not sure If I fully understand your question. However, I will try to
> show the code structure here:
>
> skeleton code in plugin.py file:
>
> from ckan.logic.action.get import *user_show*
> import ckan.plugin as p
>
> def show_user(context, data_dict):
> # code to manipulating the data_dict here
> return *user_show*(context, data_dict) #* this where the infinite
> loop happens*
>
> class MyPlugin(p.SingletonPlugin):
> p.implements(p.IActions)
>
> # other code stuff here
>
>
> def get_actions(self):
> return {'*user_show*': 'show_user}
>
>
> Thanks,
> Pabitra
>
>
>
> ------------------------------
> Date: Wed, 7 May 2014 19:58:02 -0400
> From: ian at excess.org
> To: ckan-dev at lists.okfn.org
> Subject: Re: [ckan-dev] ckan 2.2 issue (seems like)
>
>
> On 7 May 2014 19:54, "Pabitra Dash" <pkdash_reena at hotmail.com> wrote:
> >
> > Hi All,
> >
> > The code that I have in my plugin and that used to work in ckan 2.1 is
> no more working in ckan 2.2. I am getting an infinite loop in part of the
> code where I am overriding a logic action function ('user_show') using the
> IActions interface get_actions(). Within my custom function show_user() I
> am calling the ckan.logic.action.get.user_show(). It used to work in ckan
> 2.1 but after upgrading to ckan 2.2 I am getting an infinite loop inside my
> show_user() function.
>
> How are you calling the original? Are you importing the action at the
> module level?
>
> _______________________________________________ ckan-dev mailing list
> ckan-dev at lists.okfn.org https://lists.okfn.org/mailman/listinfo/ckan-devUnsubscribe:
> https://lists.okfn.org/mailman/options/ckan-dev
>
> _______________________________________________ ckan-dev mailing list
> ckan-dev at lists.okfn.org https://lists.okfn.org/mailman/listinfo/ckan-devUnsubscribe:
> https://lists.okfn.org/mailman/options/ckan-dev
>
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>
>
--
Vítor Baptista
Developer | http://vitorbaptista.com |
LinkedIn<http://www.linkedin.com/in/vitorbaptista>|
@vitorbaptista <http://twitter.com/vitorbaptista>
The Open Knowledge Foundation <http://okfn.org>
*Empowering through Open Knowledge*
http://okfn.org/ | @okfn <http://twitter.com/okfn> | OKF on
Facebook<https://www.facebook.com/OKFNetwork> |
Blog <http://blog.okfn.org/> | Newsletter<http://okfn.org/about/newsletter/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20140508/e757e496/attachment-0003.html>
More information about the ckan-dev
mailing list