Commit 43e553f1 authored by Marko Kuder's avatar Marko Kuder
Browse files

Merge branch 'fix/transaction' into 'development'

Fix/transaction

See merge request !14
parents b0b57be8 676c6099
......@@ -38,7 +38,15 @@ class RemoveRevisions(CkanCommand):
def are_equal(self, old_revision, new_revision):
equal = True
for attr in self.attributes:
if getattr(old_revision, attr) != getattr(new_revision, attr):
if attr == 'url' and getattr(old_revision, 'url_type') == 'upload' and getattr(new_revision, 'url_type') == 'upload':
#compare without protocol prefix and domain, because on uploaded file url generation,
#some plugins might change http into https or localhost might be stored instead of site url
old_url = getattr(old_revision, attr).split('//',1)[-1].split('/',1)[-1]
new_url = getattr(new_revision, attr).split('//',1)[-1].split('/',1)[-1]
if old_url != new_url:
equal = False
break
elif getattr(old_revision, attr) != getattr(new_revision, attr):
equal = False
break
return equal
......
......@@ -79,4 +79,5 @@ def _update_search_index(package_id, log):
package = p.toolkit.get_action('package_show')(
context_, {'id': package_id})
package_index.index_package(package, defer_commit=False)
model.Session.commit()
log.info('Search indexed %s', package['name'])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment