[#91] Remove config fields from source dict before indexing

We don't need them and will avoid indexing errors
This commit is contained in:
amercader 2014-06-27 16:54:39 +01:00
parent a59ab4b5ff
commit 58a873ac7a
1 changed files with 9 additions and 1 deletions

View File

@ -1,4 +1,5 @@
import hashlib
import json
import logging
import datetime
@ -389,7 +390,14 @@ def harvest_source_reindex(context, data_dict):
{'id': harvest_source_id})
log.debug('Updating search index for harvest source {0}'.format(harvest_source_id))
# Remove configuration values
new_dict = {}
if package_dict.get('config'):
config = json.loads(package_dict['config'])
for key, value in package_dict.iteritems():
if key not in config:
new_dict[key] = value
package_index = PackageSearchIndex()
package_index.index_package(package_dict, defer_commit=defer_commit)
package_index.index_package(new_dict, defer_commit=defer_commit)
return True