[ckan-dev] ckan 2.2 issue (seems like)

Pabitra Dash pkdash_reena at hotmail.com
Fri May 9 23:31:13 UTC 2014


Thanks Vitor.
Here is a link to the part of the code on github:
https://gist.github.com/pkdash/4d95bdcb5450c86535f8

Line#109 where I get infinite loop
Pabitra

From: vitor at vitorbaptista.com
Date: Fri, 9 May 2014 19:20:09 -0300
To: ckan-dev at lists.okfn.org
Subject: Re: [ckan-dev] ckan 2.2 issue (seems like)

Hi Pabitra,
Could you share your code?
Cheers,

2014-05-09 14:06 GMT-03:00 Pabitra Dash <pkdash_reena at hotmail.com>:





Hi Vitor,
Thanks for responding to my issue. Whether I use get_action() or call the action function directly it results in infinite loop. One confusing observation that I have made so far is that this problem of infinite loop does not happen with action functions like package_create(), package_update() or package_show(). The action function I am having problem with is the user_create(). This one causes infinite loop whether I call it directly or through get_action().


All my overridden action function work in ckan 2.1 but not in ckan 2.2
Pabitra




From: vitor at vitorbaptista.com


Date: Thu, 8 May 2014 15:17:59 -0300
To: ckan-dev at lists.okfn.org
Subject: Re: [ckan-dev] ckan 2.2 issue (seems like)



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_showimport 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-dev
Unsubscribe: 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 		 	   		  

_______________________________________________

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




The Open Knowledge Foundation




Empowering through Open Knowledge


http://okfn.org/  |  @okfn  |  OKF on Facebook  |  Blog  |  Newsletter








_______________________________________________
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 		 	   		  

_______________________________________________

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

The Open Knowledge Foundation

Empowering through Open Knowledge

http://okfn.org/  |  @okfn  |  OKF on Facebook  |  Blog  |  Newsletter





_______________________________________________
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 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20140509/947f7ccb/attachment-0003.html>


More information about the ckan-dev mailing list