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

fix fallback to normal default value #5

Merged
merged 2 commits into from
Oct 26, 2023
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/plone-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
~/.cache/pip
~/buildout-cache
~/extends
key: ${{ runner.os }}-deps-cache-${{ hashFiles('setup.py') }}-${{ hashFiles('*.cfg') }} }}
key: ${{ matrix.python-version }}-deps-cache-${{ hashFiles('setup.py') }}-${{ hashFiles('*.cfg') }} }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
Expand Down Expand Up @@ -73,7 +73,7 @@ jobs:
~/.cache/pip
~/buildout-cache
~/extends
key: ${{ runner.os }}-deps-cache-${{ hashFiles('setup.py') }}-${{ hashFiles('*.cfg') }} }}
key: ${{ matrix.python-version }}-deps-cache-${{ hashFiles('setup.py') }}-${{ hashFiles('*.cfg') }} }}
- name: Install system libraries
run: apt-get install libxml2-dev libxslt1-dev libjpeg-dev
- name: setup buildout cache
Expand Down
13 changes: 10 additions & 3 deletions src/jazkarta/easyformplugin/salesforce/prefill.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from collective.easyform.api import get_actions
from collective.easyform.interfaces import IEasyForm
from collective.easyform.interfaces import IEasyFormForm
from collective.easyform.fields import superAdapter
from dateutil.parser import parse
from simple_salesforce import Salesforce
from z3c.form.interfaces import IValue
Expand Down Expand Up @@ -37,9 +38,15 @@ def prefill_value_factory(context, request, view, field, widget):
if expr == "form:%s" % field.__name__:
return SalesforcePrefillValue(form, field, operation, sf_field)

# Didn't find one, so return None
# so that the IValue adapter lookup continues to the next one
return None
# Didn't find one, fall back to less specific adapter
adapter = superAdapter(
IJazkartaEasyformpluginSalesforceLayer,
prefill_value_factory,
(context, request, view, field, widget),
name="default",
)
if adapter is not None:
return adapter


@implementer(IValue)
Expand Down
Loading