[#84] Fix auth audit exception when creating datasets

This was caused by a combination of the auth audit leaking and the
harvester reusing the context for the package_show and package_create
actions. If the package is not found, package_show does not call
check_access, and the auth audit does not pass. This is stored in the
context (`__auth_audit`) and is raised next time that we call
get_action (when we call package_create with the same context)

It could potentially be fixed on master, but it is probably quite rare.
This commit is contained in:
amercader 2014-02-10 18:22:48 +00:00
parent 5b677b6099
commit 2a07a144fc
1 changed files with 4 additions and 0 deletions

View File

@ -193,6 +193,10 @@ class HarvesterBase(SingletonPlugin):
except NotFound:
# Package needs to be created
# Get rid of auth audit on the context otherwise we'll get an
# exception
context.pop('__auth_audit', None)
# Set name if not already there
package_dict.setdefault('name', self._gen_new_name(package_dict['title']))