- 11 Jul, 2024 40 commits
-
-
Jérome Perrin authored
roundDebitCredit does not raise in case of big difference since 696bc0d2 (2009-02-06 yo * Stop raising an exception, even if the credit is not equal to the debit in a built delivery, in the post processing script, because the builder may not blindly adopt prevision when updating existing lines, thus it can be unbalanced., 2009-02-06) This assertRaises syntax does nothing on python2 and was an error on python2. Update the test to test the actual behavior
-
Kazuhiko Shiozaki authored
-
Kazuhiko Shiozaki authored
-
Kazuhiko Shiozaki authored
-
Romain Courteaud authored
-
Romain Courteaud authored
-
Romain Courteaud authored
-
Romain Courteaud authored
-
Titouan Soulard authored
When trying to use `MemcachedTool` without the `python-memcached` package, a dummy implementation is supposed to allow installation while giving a warning when called. This dummy implementation was broken because it was calling a wrong class, named `_MemcachedTool`, which did not exist. Instead, `_MemcacheTool` did exist and was used for the real implementation. This commit renames `_MemcacheTool` to `_MemcachedTool` to allow dummy implementation to work.
-
Jérome Perrin authored
Fixes an logged error while indexing: 2024-03-07 23:44:21.997 WARNING CMFActivity Message dropped (no object found at path ('', 'erp5_portal_ec7d28d9ada99a2cad998125d59fc158', 'image_module', 'gadget_officejs_appstore_app_text_editor_icon_text_editor_png')) Traceback (most recent call last): File "/srv/slapgrid/slappart22/t/eje/soft/de456d85f70e1b1a086396326977c83c/parts/erp5/product/CMFActivity/ActivityTool.py", line 262, in getObject obj = self._getObject(activity_tool) File "/srv/slapgrid/slappart22/t/eje/soft/de456d85f70e1b1a086396326977c83c/parts/erp5/product/CMFActivity/ActivityTool.py", line 256, in _getObject obj = obj[id] File "/srv/slapgrid/slappart22/t/eje/soft/de456d85f70e1b1a086396326977c83c/eggs/Zope-4.8.9+slapospatched002-py2.7.egg/OFS/ObjectManager.py", line 843, in __getitem__ raise KeyError(key) KeyError: 'gadget_officejs_appstore_app_text_editor_icon_text_editor_png'
-
Rafael Monnerat authored
Workflows now are viable from ERP5 UI, so redirect to /view instead
-
Jérome Perrin authored
by using str on a dict we don't produce consistent results depending on hash randomization. This was visible with erp5_core_test:testCacheTool and PYTHONHASHSEED 12 , the cache id generated in https://lab.nexedi.com/nexedi/erp5/-/blob/a0aa9184d/bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testCacheTool.py#L216-218 was "('py_script_obj', (60000,), {'result': 'a short value', 'portal_path': ('', 'erp5')})" and the cache id generated in https://lab.nexedi.com/nexedi/erp5/-/blob/a0aa9184d/bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testCacheTool.py#L239-241 with same arguments for delete was "('py_script_obj', (60000,), {'portal_path': ('', 'erp5'), 'result': 'a short value'})")
-
Jérome Perrin authored
nowadays we can use time.sleep in restricted python
-
Jérome Perrin authored
in ec835d86 (payroll_l10n_fr: add missing sorts in DSN report, 2024-02-28) we added sorts so that the report is deterministic when hash randomization is enabled, but this was not enough, when iterating through employee_ctp to find the social_contribution_organisation, not all records have a corporate_registration_code, so we check that it's present before accessing it. Also, one `sorted` that was added was incorrect, because the elements are dict, so they can not be compared on python3.
-
Jérome Perrin authored
Instead of overriding the method and adjusting edit order in some class, define "_default_edit_order" as a class value and use it in Base._edit as default value when caller do not explicitly pass edit_order. This was made to keep the default edit order consistent with the order of edits on python2 for properties where the edit order matters. This affects mostly scripts, when for example in a script we do: delivery.edit(start_date=d, stop_date=d) on python2 without PYTHONHASHSEED, stop_date is also set, so we keep this behavior (that is assumed by some tests). We also change the order of edit for other properties not constraint by edit_order to edit them in alphabetic order, to have a constant deterministic behavior. Co-authored-by: Kazuhiko SHIOZAKI <kazuhiko@nexedi.com>
-
Jérome Perrin authored
Because this was using a set, the order in which property sheets were used when generating classes was not deterministic. This can make a different if two property sheets define the same property. This was the case for short_title property, which was defined with different default values in DublinCore and SimpleItem property sheets. With this change the behavior is always same when hash randomization is enabled. Property sheets can be defined in classes or on the portal type. The test only covers the case that a property defined on the portal type must override the same property defined on a class, but the expected behavior is also that property sheets defined on a class override property sheets from parent class.
-
Jérome Perrin authored
With a perfect configuration, this should probably does not matter, because the order of interactions should not be important (if there are dependencies they should be handled more explicitly), but this makes the behavior deterministic. Co-authored-by: Kazuhiko SHIOZAKI <kazuhiko@nexedi.com>
-
Jérome Perrin authored
movement.hasCategory('quantity_unit') was always false, it was a misunderstanding of hasCategory API. This was working anyway because of the order of edit (which depends on iteration order of **kw arguments passed to edit), this was only working when quantity unit was set before resource. ( this was revealed by test_01_quantity_unit_copied from testInvoice running on python2 with PYTHONHASHSEED=164 )
-
Jérome Perrin authored
We have DublinCore.short_title and SimpleItem.short_title, make the two use the same default value for consistency.
-
Kazuhiko Shiozaki authored
-
Kazuhiko Shiozaki authored
-
Jérome Perrin authored
-
Jérome Perrin authored
This is what happens with PYTHONHASHSEED=0, but when set to something random, the order was not guaranteed.
-
Jérome Perrin authored
-
Jérome Perrin authored
-
Jérome Perrin authored
Revealed by erp5_accounting_ui_test:testERP5CurrencyExchangeLine PYTHONHASHSEED: 438 on py2 Co-authored-by: Kazuhiko SHIOZAKI <kazuhiko@nexedi.com>
-
Jérome Perrin authored
When searching for something like for example "A AND B", make sure that the AND complex query contains query for ["A", "B"], not ["B", "A"]. This is probably always equivalent in generated SQL, but this makes testing easier. Revealed by testSQLCatalog.TestSQLCatalog with PYTHONHASHSEED 279 on py2
-
Jérome Perrin authored
When cutting with bytes, we might cut in the middle of a multi-bytes character and later decoding it would cause an error. We could switch to sending bytes encoded to base64, because the limit would be more natural to be number of bytes, but just decoding and cutting the string is easier and in practice not so different. This bug was revealed by testERP5SyncML.TestERP5SyncML.test_28_PartialData with PYTHONHASHSEED 872 and test_28_PartialData with PYTHONHASHSEED 238 ( on python2 )
-
Jérome Perrin authored
The order is used during syncml and if "title" comes before "first_name" and "last_name", synchronizing persons causes conflicts (because title of persons is computed from first_name and last_name). Luckily, sorting properties gives an order that is OK for syncml tests, so we don't need to invent a new mechanism to control the order of properties in asXML.
-
Jérome Perrin authored
if their content type ended in xml ( such as image/svg+xml ), TextDocument._convertToBaseFormat was resetting the content type to application/xml. When doing something like: wp = web_page_module.newContent( portal_type='Web Page', content_type='image/svg+xml', text_content=svg ) wp.getContentType() was sometimes 'image/svg+xml' sometimes 'application/xml', depending on the order of edit.
-
Jérome Perrin authored
-
Jérome Perrin authored
for erp5_web_renderjs_ui_test:testFunctionalRJSPage failures with PYTHONHASHSEED 347
-
Jérome Perrin authored
This produces stable output that we can assert more easily in the test
-
Jérome Perrin authored
-
Jérome Perrin authored
-
Jérome Perrin authored
This solves a failure with testBudget, it should only impact test, but it's probably better to have a deterministic ordering here.
-
Jérome Perrin authored
When a business template has multiple dependencies, these dependencies were installed in an order defined by iteration in dictionaries, which is not deterministic when using a random PYTHONHASHSEED on python2. As an example, when we have business template "b" depending on "b1" and "b2", the only guarantee was that "b" would be installed after "b1" and "b2", but which one of "b1" and "b2" is installed first was undefined, now it is stable, "b1" should be installed before "b2", because we added a sort. In practice it should not matter, because if in that example "b2" really needs to be installed after "b1", then "b2" should declare a dependency on "b1". test_resolveBusinessTemplateListDependency was failing on python3 because the order on python3 was different from the one using PYTHONHASHSEED=0 on python2.
-
Jérome Perrin authored
In that case, the order of actions rendering is undefined, we want to have unique priorities to have deterministic order of actions.
-
Jérome Perrin authored
This probably happened only in the test, but it's safer not to retry for ever.
-
Jérome Perrin authored
With PYTHONHASHSEED=0, editing a document like this: foo.edit( title="live_test_%s" % new_id, reference="live_test_%s" % new_id ) only sets the reference, because it sets the reference first and then when setting title it already has the "live_test_%s" % new_id value ( because title is acquired from reference). With PYTHONHASHSEED set, the order is not guaranteed and sometimes title is edited before reference. This is revealed by testHalJsonStyle.TestERP5Document_getHateoas_mode_search with PYTHONHASHSEED 465.
-