diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6e25052d..b30fd154 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,7 +55,7 @@ jobs: # python setup - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} diff --git a/CHANGES.rst b/CHANGES.rst index 82cf50af..b53871f2 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,8 +4,12 @@ Changelog 8.4.3 (unreleased) ------------------ -- Nothing changed yet. - +- Avoided failure in v4 migration when default types are AT + [sgeulette] +- Updated registry after settings schema change + [sgeulette] +- Handled decoding exception + [sgeulette] 8.4.2 (2021-04-08) ------------------ diff --git a/src/collective/solr/indexer.py b/src/collective/solr/indexer.py index decc4032..6f33d93f 100644 --- a/src/collective/solr/indexer.py +++ b/src/collective/solr/indexer.py @@ -392,7 +392,12 @@ def getData(self, obj, attributes=None): separator = getattr(field, "separator", " ") value = separator.join(value) if isinstance(value, six.binary_type): - value = value.decode("utf-8") + for encod in ('utf-8', 'latin-1'): + try: + value = value.decode(encod) + break + except Exception: # noqa + pass data[name] = value missing = set(schema.requiredFields) - set(data.keys()) return data, missing diff --git a/src/collective/solr/setuphandlers.py b/src/collective/solr/setuphandlers.py index 4754632a..d9269c37 100644 --- a/src/collective/solr/setuphandlers.py +++ b/src/collective/solr/setuphandlers.py @@ -35,6 +35,10 @@ def update_registry(context): def migrateTo4(context): + setup_tool = getToolByName(context, "portal_setup") + setup_tool.runImportStepFromProfile(PROFILE_ID, "plone.app.registry") + logger.info("Updated registry records to add force_simple_search record") + registry = getUtility(IRegistry) if "collective.solr.async" in registry.records: old_record = registry.records["collective.solr.async"] @@ -58,7 +62,7 @@ def migrateTo4(context): if type_id not in pt.objectIds(): continue fti = pt[type_id] - if new_behavior not in fti.behaviors: + if new_behavior not in getattr(fti, 'behaviors', [new_behavior]): fti.behaviors += (new_behavior,) logger.info("Added new behavior to {}".format(type_id))