Ticket #2605 (closed enhancement: fixed)
Problem with user.get_groups
Reported by: | ross | Owned by: | ross |
---|---|---|---|
Priority: | awaiting triage | Milestone: | ckan-v1.8 |
Component: | ckan | Keywords: | |
Cc: | Repository: | ckan | |
Theme: | none |
Description (last modified by ross) (diff)
From DR at DGU
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?
diff at https://gist.github.com/3003117
Change History
comment:1 Changed 22 months ago by ross
- Status changed from new to accepted
- Description modified (diff)
comment:2 Changed 22 months ago by ross
Seeing *very* strange behaviour here with the tests working fine when run individually, but when run as part of the entire suite it is returning an old group (called david) that is NOT in the database (set breakpoint, queried db, not there).
Hoping Mr Raznicks sqlalchemy skills will be able to see what is going on with this.