[ckan-dev] User.get_groups problem
David Read
david.read at hackneyworkshop.com
Wed Jun 27 10:19:38 UTC 2012
Ross,
I had some slightly obscure problems with the model.User.get_groups()
function in DGU today and I think this is a part of the code you know
about best. There were no tests so I added one that shows the problem
I had:
https://gist.github.com/3003117
Basically get_groups() appears to cache its results, but this falls
down when subsequent calls are in a different session. We get this
when saving a dataset. get_groups() first gets called in the
controller when it is trying to work out what permissions the user
has. It later gets called, and by this time c.userobj is detached, so
get_groups() fails.
I'm working around this by refreshing c.userobj (from c.user) before
calling get_groups(), but I wonder if the get_groups caching could
detect the detached session and bypass the cache in this case?
BTW you may also wish to add this to the CKAN codebase.
Dave
More information about the ckan-dev
mailing list