Skip to content

Commit

Permalink
Merge pull request #551 from ckan/ckan-2.11-support
Browse files Browse the repository at this point in the history
More CKAN 2.11 support changes
  • Loading branch information
amercader authored Jul 11, 2024
2 parents 7a6566f + 790cdcd commit bf849f1
Show file tree
Hide file tree
Showing 6 changed files with 166 additions and 229 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ jobs:
needs: lint
strategy:
matrix:
ckan-version: ["master", "2.10", 2.9]
ckan-version: ["2.11", "2.10", 2.9]
fail-fast: false

name: CKAN ${{ matrix.ckan-version }}
runs-on: ubuntu-latest
container:
image: openknowledge/ckan-dev:${{ matrix.ckan-version }}
image: ckan/ckan-dev:${{ matrix.ckan-version }}
services:
solr:
image: ckan/ckan-solr:${{ matrix.ckan-version }}
image: ckan/ckan-solr:${{ matrix.ckan-version }}-solr9
postgres:
image: ckan/ckan-postgres-dev:${{ matrix.ckan-version }}
env:
Expand Down
11 changes: 3 additions & 8 deletions ckanext/harvest/harvesters/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import uuid

from sqlalchemy import exists, and_
from sqlalchemy.sql import update, bindparam
from sqlalchemy.orm import contains_eager

from ckantoolkit import config
Expand Down Expand Up @@ -315,15 +314,11 @@ def _create_or_update_package(self, package_dict, harvest_object,
return 'unchanged'

# Flag the other objects linking to this package as not current anymore
from ckanext.harvest.model import harvest_object_table
conn = Session.connection()
u = update(harvest_object_table)\
.where(harvest_object_table.c.package_id == bindparam('b_package_id')) \
.values(current=False)
conn.execute(u, b_package_id=new_package['id'])
Session.query(HarvestObject).filter(
HarvestObject.package_id == new_package["id"]).update(
{"current": False})

# Flag this as the current harvest object

harvest_object.package_id = new_package['id']
harvest_object.current = True
harvest_object.save()
Expand Down
Loading

0 comments on commit bf849f1

Please sign in to comment.