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
Failures with changed repeat syntax newer Zope/chameleon #94
Labels
Comments
Maurits van Rees wrote at 2020-8-21 13:49 -0700:
In Zope/templates/chameleon the repeat syntax has changed slightly. Apparently previously you had to call `repeat['widget'].index()` to get the index number, but now you directly get the integer without needing to call it.
...
The base template in `z3c.form` has the same problem, as do several other templates:
```
$ ack repeat | ack index
browser/multi_hidden.pt:6: define="key_widget python:view.key_widgets[repeat['widget'].index()];">
browser/multi_display.pt:25: tal:define="key_widget python:view.key_widgets[repeat['widget'].index()];"
browser/multi_input.pt:12: tal:define="key_widget python:view.key_widgets[repeat['widget'].index()];">
```
This is in `z3c.form` 3.7.0.
I have no time right now to fix it, only to create an issue.
This is related to "zopefoundation/Zope#875".
In short: `zope.tales` (for which `z3c.form` has been developed)
defines a so called "Iterator" with methods; for `Zope` and
even more `chameleon` some of those methods are redefined as
(integer) properties -- introducing an incompatibilty
between `Zope`/`chameleon` on one side and `zope.tales` on the other.
To avoid problems created by those incompatibilities,
it is best to access repeat variable metadata (managed by the
above "Iterator"s) via path expressions which automatically call
methods and thereby hide the method/property difference.
For the cases above, `repeat['widget'].index()`
could be replaced by `path('repeat/widget/index`).
|
Thanks for your reaction. That code is how I solve it too. |
mauritsvanrees
added a commit
that referenced
this issue
Aug 28, 2020
mauritsvanrees
added a commit
that referenced
this issue
Aug 28, 2020
mauritsvanrees
added a commit
that referenced
this issue
Aug 28, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In Zope/templates/chameleon the repeat syntax has changed slightly. Apparently previously you had to call
repeat['widget'].index()
to get the index number, but now you directly get the integer without needing to call it.See plone/plone.app.z3cform#116 for such a failure in
plone.app.z3cform
in a template that overrides a base template inz3c.form
. And see plone/plone.app.z3cform#117 for the fix.The base template in
z3c.form
has the same problem, as do several other templates:This is in
z3c.form
3.7.0.I have no time right now to fix it, only to create an issue.
The text was updated successfully, but these errors were encountered: