Commit b92bc438 authored by Tomáš Peterka's avatar Tomáš Peterka Committed by Tomáš Peterka

[erp5_core] Rename Form_getListbox to Base_getListbox

parent 49908335
......@@ -207,7 +207,7 @@ select_all = extra_param.get("basedialog_select_all", 0)
# inject `uids` into Scripts **kwargs when we got any `query` (empty or filled)
if query is not None:
listbox = getattr(context, form_id).Form_getListbox()
listbox = getattr(context, form_id).Base_getListbox()
if listbox is not None:
kw['uids'] = [int(getattr(document, "uid"))
for document in context.Base_searchUsingListbox(listbox, query)]
......
......@@ -1073,7 +1073,7 @@ def renderForm(traversed_document, form, response_dict, key_prefix=None, selecti
try:
if last_form_id:
last_form = getattr(context, last_form_id)
last_listbox = last_form.Form_getListbox()
last_listbox = last_form.Base_getListbox()
# In order not to use Selections we need to pass all search attributes to *a listbox inside the form dialog*
# in case there was a listbox in the previous form. No other case!
if last_listbox:
......
......@@ -57,8 +57,10 @@ def getDocumentGroupByWorkflowStateList(self, form_id='', **kw):
Base_translateString = portal.Base_translateString
wf_tool = portal.portal_workflow
selection_tool = portal.portal_selections
last_form = getattr(self, form_id)
selection_name = request['selection_name']
last_listbox = last_form.Base_getListbox()
selection_name = last_listbox.get_value('selection_name')
# guess all column name from catalog schema
possible_state_list = [column_name.split('.')[1] for column_name in
......
......@@ -45,7 +45,9 @@
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
<tuple>
<string>W: 55, 2: Unused variable \'request\' (unused-variable)</string>
</tuple>
</value>
</item>
<item>
......
......@@ -2,8 +2,7 @@
This script should be used to detect a listbox without having to name it "listbox".
:param form: {Form} optional Form instance instead of calling this script directly on a Form
:param form_id: {str} if specified the Script must be called on currently traversed document
:param form_or_id: {Form/str} optional Form instance (otherwise context-Form) or form_id (will be retrieved on context-Document)
Christophe Dumez <christophe@nexedi.com>
"""
......@@ -17,11 +16,12 @@ def isListBox(field):
return True
return False
if form_id is not None:
form = getattr(context, form_id)
if form is None:
if form_or_id is None:
form = context
elif isinstance(form_or_id, str):
form = getattr(context, form_or_id)
else:
form = form_or_id
if form.meta_type not in ('ERP5 Form', 'Folder', 'ERP5 Folder'):
raise RuntimeError("Cannot get Listbox field from \"{!s}\"! Supported is only ERP5 Form and (ERP5) Folder".format(form.meta_type))
......
......@@ -50,11 +50,11 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>form=None, form_id=None</string> </value>
<value> <string>form_or_id=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Form_getListbox</string> </value>
<value> <string>Base_getListbox</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -4,6 +4,6 @@ This script is intended to be used only internally.
"""
form = getattr(context, form_id)
listbox = form.Form_getListbox()
listbox = form.Base_getListbox()
return context.Base_searchUsingListbox(listbox, query, sort_on, limit)
......@@ -95,7 +95,7 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: here.Form_getListbox(form_id=request.get(\'form_id\')).getId()</string> </value>
<value> <string>python: here.Base_getListbox(request.get("form_id")).getId()</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -276,7 +276,7 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: here.Form_getListbox(form_id=request.get(\'form_id\')).getId()</string> </value>
<value> <string>python: here.Base_getListbox(form_id=request.get(\'form_id\')).getId()</string> </value>
</item>
</dictionary>
</pickle>
......
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