Commit ae7e28de authored by Jérome Perrin's avatar Jérome Perrin

Merge remote-tracking branch 'upstream/master' into zope4py3

parents 113a5a3f fff85e8d
Pipeline #38828 failed with stage
in 0 seconds
......@@ -2007,14 +2007,20 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
editable_field_dict[select] = proxy_form.get_field(proxy_field_name, include_disabled=1)
break
# handle the case when list-scripts are ignoring `limit` - paginate for them
if limit is not None:
# handle the case when list-scripts are ignoring `limit` - paginate for them.
# Except when `limit` is explicitely set to 0, meaning no limit.
if limit:
if isinstance(limit, (tuple, list)):
start, num_items = map(int, limit)
elif isinstance(limit, int):
start, num_items = 0, limit
else:
start, num_items = 0, int(limit)
if isinstance(limit, int):
limit_int = limit
else:
limit_int = int(limit)
if limit_int == 0:
start, num_items = 0, len(search_result_iterable)
else:
start, num_items = 0, int(limit_int)
if not (is_rendering_listbox and not has_listbox_a_count_method):
# the limit was most likely taken into account thus we don't need to slice
start, num_items = 0, len(search_result_iterable)
......
movement = context
delivery_uid = movement.getExplanationUid()
destination_uid = movement.getDestinationUid()
resource_uid = movement.getResourceUid()
variation_text = movement.getVariationText()
packed_quantity = 0
sql_list = movement.Movement_zGetPackedQuantity(
node_uid=destination_uid,
explanation_uid=delivery_uid,
resource_uid=resource_uid,
variation_text=variation_text)
......
SELECT
SUM(movement.quantity) AS quantity
SUM(stock.quantity) AS quantity
FROM
catalog AS container_cell, movement
catalog AS container_cell, stock
WHERE
movement.explanation_uid = <dtml-sqlvar explanation_uid type="int">
stock.explanation_uid = <dtml-sqlvar explanation_uid type="int">
AND container_cell.has_cell_content = 0
AND container_cell.uid = movement.uid
AND container_cell.uid = stock.uid
AND (container_cell.portal_type = "Container Cell"
OR container_cell.portal_type = "Container Line")
<dtml-if resource_uid>
AND movement.resource_uid = <dtml-sqlvar resource_uid type="int">
AND stock.resource_uid = <dtml-sqlvar resource_uid type="int">
</dtml-if>
<dtml-if node_uid>
AND stock.node_uid = <dtml-sqlvar node_uid type="int">
</dtml-if>
<dtml-if variation_text>
AND movement.variation_text = <dtml-sqlvar variation_text type="string">
AND stock.variation_text = <dtml-sqlvar variation_text type="string">
</dtml-if>
......@@ -27,6 +27,7 @@
<item>
<key> <string>arguments_src</string> </key>
<value> <string>explanation_uid\n
node_uid\n
resource_uid\n
variation_text</string> </value>
</item>
......
......@@ -104,7 +104,7 @@
<dictionary>
<item>
<key> <string>_defined_in_class</string> </key>
<value> <int>1</int> </value>
<value> <bool>True</bool> </value>
</item>
<item>
<key> <string>_hookname</string> </key>
......
......@@ -104,7 +104,7 @@
<dictionary>
<item>
<key> <string>_defined_in_class</string> </key>
<value> <int>1</int> </value>
<value> <bool>True</bool> </value>
</item>
<item>
<key> <string>_hookname</string> </key>
......
......@@ -69,7 +69,7 @@
<dictionary>
<item>
<key> <string>_defined_in_class</string> </key>
<value> <int>1</int> </value>
<value> <bool>True</bool> </value>
</item>
<item>
<key> <string>_hookname</string> </key>
......
......@@ -1214,7 +1214,7 @@
select_list.push("uid");
if (gadget.state.lines === 0) {
limit_options = undefined;
limit_options = 0;
} else {
limit_options = [gadget.state.begin_from, gadget.state.lines + 1];
}
......
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <unicode>zope</unicode> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -242,7 +242,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>994.13949.44825.36573</string> </value>
<value> <string>1021.46754.58269.53777</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -262,7 +262,7 @@
</tuple>
<state>
<tuple>
<float>1629394496.1</float>
<float>1735631070.51</float>
<string>UTC</string>
</tuple>
</state>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="_reconstructor" module="copy_reg"/>
</klass>
<tuple>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
<global name="object" module="__builtin__"/>
<none/>
</tuple>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<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>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testInfiniteListbox</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test Infinite ListBox</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">A listbox with a "lines" property of "0" should not set a display limit</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/PTZuite_CommonTemplate/macros/init" />
<tr><td>open</td>
<td>${base_url}/foo_module/ListBoxZuite_reset</td><td></td></tr>
<tr><td>assertTextPresent</td>
<td>Reset Successfully.</td><td></td></tr>
<tr><td>open</td>
<td>${base_url}/foo_module/FooModule_createObjects?start:int=1&amp;num:int=100&amp;create_line:int=0</td><td></td></tr>
<tr><td>assertTextPresent</td>
<td>Created Successfully.</td><td></td></tr>
<tr><td>open</td>
<td>${base_url}/foo_module/FooModule_viewFooList/listbox/ListBox_setPropertyList?field_list_method=FooModule_listAsContext&amp;field_columns=id%7CID%0Aquantity%7CQuantity&amp;field_lines=0</td>
<td></td></tr>
<tr><td>assertTextPresent</td>
<td>Set Successfully.</td><td></td></tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
<!-- Shortcut for full renderjs url -->
<tr><td>store</td>
<td>${base_url}/web_site_module/renderjs_runner</td>
<td>renderjs_url</td></tr>
<tr><td>open</td>
<td>${renderjs_url}/#/foo_module</td><td></td></tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_listbox_loaded" />
<!-- Check that for the 100th created object, for which the quantity is -90,
we have '-90' displayed
-->
<tr>
<td>assertElementPresent</td>
<td>//a[contains(@href, "jio_key=foo_module%2F100") and text()="-90"]</td>
<td></td>
</tr>
<!-- Check that the listbox header counting the elements displays the correct info -->
<tr>
<td>assertElementPresent</td>
<td>//div[contains(@class, "ui-table-header")]/h1[text()="Foos "]/span[text()="(100)"]</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
......@@ -186,7 +186,7 @@ def editMatrixBox(matrixbox_field, matrixbox):
else:
raise ValueError("Could not create cell %s" % str(cell_index_tuple))
else:
raise ValueError("Cell %s does not exist %s" % str(cell_index_tuple))
raise ValueError("Cell %s does not exist" % str(cell_index_tuple))
field_prefix_len = len(field_prefix)
......
......@@ -25,8 +25,10 @@ if not (portal_type in destination.getVisibleAllowedContentTypeList() and
if batch_mode:
return None
else:
return context.Base_redirect(keep_items={'portal_status_message':
translateString("You are not allowed to clone this object.")})
return context.Base_redirect(keep_items={
'portal_status_message': translateString("You are not allowed to clone this object."),
'portal_status_level': 'error',
})
# prepare query params
kw = {'portal_type' : translateString(portal_type)}
......@@ -36,9 +38,14 @@ if web_mode:
if script is not None:
msg = script(**form_data)
if msg is not None:
return context.Base_redirect(form_id,
return context.Base_redirect(
form_id,
editable_mode=editable_mode,
keep_items={'portal_status_message': msg})
keep_items={
'portal_status_message': msg,
'portal_status_level': 'error',
}
)
# Standard cloning method
if clone:
......
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