1

I have a Python app based on Pylons and Jinja2. There is a widget:

@colander.deferred
def deferred_last_results_widget(node, kw):
"""
Widget for last results widget
Empty choice is added to list by default.

:param node: name of the node
:param kw: key/value dictionary
:return: Selectable widget
"""
choices = kw.get('choices', dict()).get(node.name)
value_id = kw.get('choices', dict()).get('value_id')
without_empty = kw.get('no_empty_value')
disabled = kw.get('disabled', {})
if disabled and node.name in disabled:
    disabled = 'disabled'
return LastResultsWidget(values=choices,
                         value_id=value_id,
                         css_class=kw.get('css_class', None),
                         required=False, id=kw.get('select_id'),
                         disabled=disabled,
                         onchange_action=kw.get('onchange_action', None))

It is used to display the data with a SchemaNode:

assessments = SchemaNode(String(), widget=deferred_last_results_widget,
                         title='Assessment:', missing='')

Mentioned SchemaNode is an element of a Form. After restarting the app I do click on a data row to display detailed data. The form is rendered correctly and the widget shows correct data (used twice in this form - both correct and different). When I come back to the list and click another data row the widget shows the same data as for the row I clicked first. It behaves like this until I restart the app.

Question: Is @colander.deferred (or maybe sth else) making the widget to behave like this? Unfortunately it's not my code but I need to find out why it's not displaying correct data and got stuck to the first initial values.

Thank you in advance for all suggestions.

Piotr
  • 51
  • 6

1 Answers1

0

It was an error withi this certain Colader version. It was forcing the widget to behave singleton-like.

Piotr
  • 51
  • 6