Skip to content

Commit

Permalink
fix fallback to normal default value (#5)
Browse files Browse the repository at this point in the history
* fix fallback to normal default value

* use python version in cache key
  • Loading branch information
davisagli authored Oct 26, 2023
1 parent c9befad commit 7e98815
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
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

0 comments on commit 7e98815

Please sign in to comment.