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

Adding field to fieldset introduced by other behavior not working, throwing an error #68

Open
zopyx opened this issue Jul 20, 2019 · 1 comment

Comments

@zopyx
Copy link
Member

zopyx commented Jul 20, 2019

Plone 5.2, plone.schemaeditor 2.0.20.

Screenshot shows the schemaeditor for xmldirector.connector with a custom behavior adding some fields through the "guideline" fielset. Trying to add a custom field to the field throws an error.

Traceback (innermost last):
  Module ZPublisher.WSGIPublisher, line 142, in transaction_pubevents
  Module ZPublisher.WSGIPublisher, line 295, in publish_module
  Module ZPublisher.WSGIPublisher, line 229, in publish
  Module ZPublisher.mapply, line 85, in mapply
  Module ZPublisher.WSGIPublisher, line 57, in call_object
  Module plone.z3cform.layout, line 63, in __call__
  Module plone.z3cform.layout, line 47, in update
  Module plone.z3cform.fieldsets.extensible, line 65, in update
  Module plone.z3cform.patch, line 30, in GroupForm_update
  Module z3c.form.group, line 145, in update
  Module plone.app.z3cform.csrf, line 22, in execute
  Module z3c.form.action, line 98, in execute
  Module z3c.form.button, line 315, in __call__
  Module z3c.form.button, line 170, in __call__
  Module z3c.form.form, line 257, in handleAdd
  Module z3c.form.form, line 265, in createAndAdd
  Module plone.schemaeditor.browser.schema.add_field, line 83, in add
  Module plone.schemaeditor.utils, line 52, in get_fieldset_from_index
IndexError: list index out of range

> /home/ajung/sandboxes/onkopedia_buildout-plone5/eggs/plone.schemaeditor-2.0.20-py3.7.egg/plone/schemaeditor/utils.py(50)get_fieldset_from_index()
-> index = int(index or 0) - 1
(Pdb) args
schema = <SchemaClass xmldirector.connector.connector.IConnector>
index = 6
(Pdb) n
> /home/ajung/sandboxes/onkopedia_buildout-plone5/eggs/plone.schemaeditor-2.0.20-py3.7.egg/plone/schemaeditor/utils.py(51)get_fieldset_from_index()
-> fieldsets = schema.queryTaggedValue(FIELDSETS_KEY, [])
(Pdb) 
> /home/ajung/sandboxes/onkopedia_buildout-plone5/eggs/plone.schemaeditor-2.0.20-py3.7.egg/plone/schemaeditor/utils.py(52)get_fieldset_from_index()
-> return fieldsets[index] if index >= 0 else None
(Pdb) pp fieldset
*** NameError: name 'fieldset' is not defined
(Pdb) pp fieldsets
[]

@frapell
Copy link
Member

frapell commented Jul 27, 2022

I have commited a fix for this in #92 and plone/mockup#1203 which prevents fields to be added into fieldsets from behaviors, since I don't think this was ever intended.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants