Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8.x.x upgrade 4 improvements #360

Open
wants to merge 3 commits into
base: 8.x.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand Down
8 changes: 6 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
------------------
Expand Down
7 changes: 6 additions & 1 deletion src/collective/solr/indexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 5 additions & 1 deletion src/collective/solr/setuphandlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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))

Expand Down