Commit 5ae7e594 authored by Jérome Perrin's avatar Jérome Perrin

ods_style: use a script to properly get all editable fields

parent eadfcdd2
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>request = container.REQUEST\n
\n
# XXX this is a restricted environment available reimplementation of ListboxRenderer.getEditableField\n
editable_columns = set(context.get_value(\'columns\', REQUEST=request)\n
+ context.get_value(\'all_columns\', REQUEST=request))\n
\n
editable_fields = {}\n
\n
def getEditableField(alias):\n
"""Get an editable field for column, using column alias.\n
Return None if a field for this column does not exist.\n
"""\n
field = context\n
original_field_id = field.id\n
while True:\n
for field_id in {original_field_id, field.id}:\n
if field.aq_parent.has_field("%s_%s" % (field_id, alias), include_disabled=1):\n
return field.aq_parent.get_field("%s_%s" % (field_id, alias),\n
include_disabled=1)\n
if field.meta_type != \'ProxyField\':\n
return None\n
# if we are rendering a proxy field, also look for editable fields from\n
# the template field\'s form. This editable field can be prefixed either\n
# by the template field listbox id or by the proxy field listbox id.\n
field = field.getTemplateField().aq_inner\n
\n
for column, _ in editable_columns:\n
field = getEditableField(column)\n
if field is not None:\n
editable_fields[column] = field\n
\n
return editable_fields\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Listbox_getEditableFieldDict</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -54,7 +54,7 @@
selection_name python: listbox.get_value(\'selection_name\', REQUEST=request);\n
editable_columns python: listbox.get_value(\'editable_columns\', REQUEST=request);\n
untranslatable_columns python: [x[0] for x in listbox.get_value(\'untranslatable_columns\', REQUEST=request)];\n
editable_fields python: dict([(column[0], getattr(listbox.aq_parent, \'listbox_%s\' % column[0], None)) for column in editable_columns]);\n
editable_fields listbox/Listbox_getEditableFieldDict;\n
selection python: here.portal_selections.getSelectionFor(selection_name, REQUEST=request);\n
is_report_tree_mode selection/report_tree_mode | python: 0;\n
is_domain_tree_mode selection/domain_tree_mode | python: 0;\n
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment