laymonage / django-jsonfield-backport

Backport of the cross-DB JSONField model and form fields from Django 3.1.
https://pypi.org/project/django-jsonfield-backport
BSD 3-Clause "New" or "Revised" License
42 stars 6 forks source link

feature_classes and django-salesforce #24

Closed lociii closed 3 years ago

lociii commented 3 years ago

django-salesforce is an ORM integration to the Salesforce API. It gets set up like any other database source with it's backend identifying as vendor salesforce.

This leads to a KeyError in https://github.com/laymonage/django-jsonfield-backport/blob/56679e1999cd7d20bca1a05e6a9d793830bc72e1/src/django_jsonfield_backport/features.py#L65 because the vendor cannot be found in the feature_classes map.

What would be the best way to handle unsupported/unknown database vendors so that I can offer a pull request?

laymonage commented 3 years ago

Hi, @lociii, thanks for the report and sorry for the late reply. I think we can change that line to something like:

value = feature = getattr(feature_classes.get(connection.vendor), name, False)

That should let the value to be False as a fallback for database backends not included in feature_classes. Feel free to send in a PR if you'd like to. Otherwise, I'd commit the change myself.

lociii commented 3 years ago

On my way!

laymonage commented 3 years ago

Fixed in v1.0.3 :tada: