Commit 6866d00b authored by Tomáš Peterka's avatar Tomáš Peterka Committed by Tomáš Peterka

[hal_json] Remove external method

parent 29457833
def Listbox_getListMethodName(self, field):
""" XXXX"""
list_method = field.get_value('list_method')
try:
list_method_name = getattr(list_method, 'method_name')
except AttributeError:
list_method_name = list_method
return list_method_name
def Field_getSubFieldKeyDict(self, field, field_id, key=None):
"""XXX"""
return field.generate_subfield_key(field_id, key=key)
......
......@@ -45,9 +45,7 @@
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple>
<string>W: 11, 42: Redefining built-in \'id\' (redefined-builtin)</string>
</tuple>
<tuple/>
</value>
</item>
<item>
......
......@@ -584,7 +584,6 @@ def renderField(traversed_document, field, form, value=None, meta_type=None, key
# How to implement pagination?
# default_params.update(REQUEST.form)
lines = field.get_value('lines')
list_method_name = traversed_document.Listbox_getListMethodName(field)
list_method_query_dict = dict(
portal_type=[x[1] for x in portal_types], **default_params
)
......@@ -593,8 +592,9 @@ def renderField(traversed_document, field, form, value=None, meta_type=None, key
# Search for non-editable documents - all reports goes here
# Reports have custom search scripts which wants parameters from the form
# thus we introspect such parameters and try to find them in REQUEST
list_method = None
if list_method_name and list_method_name not in ("portal_catalog", "searchFolder", "objectValues"):
list_method = field.get_value('list_method') or None
list_method_name = list_method.getMethodName() if list_method is not None else ""
if list_method_name not in ("", "portal_catalog", "searchFolder", "objectValues"):
# we avoid accessing known protected objects and builtin functions above
try:
list_method = getattr(traversed_document, list_method_name)
......@@ -603,6 +603,8 @@ def renderField(traversed_document, field, form, value=None, meta_type=None, key
# which we will not introspect
log('ListBox {!s} list_method {} is unavailable because of "{!s}"'.format(
field, list_method_name, error), level=100)
else:
list_method = None
# Put all ListBox's search method params from REQUEST to `default_param_json`
# because old code expects synchronous render thus having all form's values
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_function</string> </key>
<value> <string>Listbox_getListMethodName</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>HalStyle</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Listbox_getListMethodName</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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