1. 11 Jul, 2024 40 commits
    • Kirill Smelkov's avatar
      pylint: Add support for XLTE · ffa147ef
      Kirill Smelkov authored
      XLTE(*) follows the same top-level packaging structure like
      wendelin.core does.
      
      Registration is done via new `register_xpkg` function instead of just
      loop so that pkgname argument is properly captured in created lambda and
      does not change after going to next iteration.
      
      (*) https://lab.nexedi.com/kirr/xlte
      
      /reviewed-by @jerome
      /reviewed-on nexedi/erp5!1762
      ffa147ef
    • Kirill Smelkov's avatar
      pylint: Fix wendelin transform to yield module with a .name · 2506a88a
      Kirill Smelkov authored
      In 5796a17a (core_test: Add test to make sure that wendelin.core
      basically works) I added wendelin_transform to pylint so that the
      checker could recognize wendelin.core's special wendelin top-level
      module/package and handle ok
      
      	from wendelin.bigarray.array_zodb import ZBigArray
      
      this works, but e.g. for plain
      
      	import wendelin			or
      	from wendelin import bigarray
      
      pylint currenly fails with
      
      	AssertionError: explicit relative import, but no context_file?
      
      To better see what is going on let's conside the following test program
      
      	"""ZZZ"""
      
      	from wendelin.bigarray.array_zodb import ZBigArray
      	from wendelin import bigarray
      
      	def main():
      	    """main"""
      	    _ = ZBigArray
      
      and run pylint on it. Here is what it gives:
      
                wendelin_transform Module(wendelin)
                -> Module()
      
          visit_from From()
            basename: wendelin.bigarray.array_zodb
            names:    [('ZBigArray', None)]
            modnode:  Module(test)
              get_imported_module From() wendelin.bigarray.array_zodb
            importedmodnode: Module(wendelin.bigarray.array_zodb)
          ('_add_imported_module', <From() l.3 [test] at 0x7ff214b4cb90>, 'wendelin.bigarray.array_zodb.ZBigArray')
                wendelin_transform Module(wendelin)
                -> Module()
      
          visit_from From()
            basename: wendelin
            names:    [('bigarray', None)]
            modnode:  Module(test)
              get_imported_module From() wendelin
                wendelin_transform Module(wendelin)
                -> Module()
            importedmodnode: Module()
          ************* Module test
          W:  4, 0: Relative import 'wendelin', should be '' (relative-import)
          ('_add_imported_module', <From() l.4 [test] at 0x7ff214b4cf50>, '.bigarray')
          Traceback (most recent call last):
            File "./x.py", line 22, in <module>
              Run(['test.py', '--reports=n'], exit=False)
            File "/home/kirr/src/tools/py/pylint/pylint/lint.py", line 1332, in __init__
              linter.check(args)
            File "/home/kirr/src/tools/py/pylint/pylint/lint.py", line 747, in check
              self._do_check(files_or_modules)
            File "/home/kirr/src/tools/py/pylint/pylint/lint.py", line 869, in _do_check
              self.check_astroid_module(ast_node, walker, rawcheckers, tokencheckers)
            File "/home/kirr/src/tools/py/pylint/pylint/lint.py", line 946, in check_astroid_module
              walker.walk(ast_node)
            File "/home/kirr/src/tools/py/pylint/pylint/utils.py", line 874, in walk
              self.walk(child)
            File "/home/kirr/src/tools/py/pylint/pylint/utils.py", line 871, in walk
              cb(astroid)
            File "/home/kirr/src/tools/py/pylint/pylint/checkers/imports.py", line 288, in visit_from
              self._add_imported_module(node, '%s.%s' % (importedmodnode.name, name))
            File "/home/kirr/src/tools/py/pylint/pylint/checkers/imports.py", line 328, in _add_imported_module
              importedmodname = get_module_part(importedmodname)
            File "/home/kirr/src/tools/py/astroid/astroid/modutils.py", line 359, in get_module_part
              'explicit relative import, but no context_file?'
          AssertionError: explicit relative import, but no context_file?
      
      we see that the line
      
      	from wendelin.bigarray.array_zodb import ZBigArray
      
      corresponds to
      
      	('_add_imported_module', <From() l.3 [test] at 0x7ff214b4cb90>, 'wendelin.bigarray.array_zodb.ZBigArray')
      
      and the line
      
      	from wendelin import bigarray
      
      corresponds to
      
      	('_add_imported_module', <From() l.4 [test] at 0x7ff214b4cf50>, '.bigarray')
      
      notice that in the latter case there is no 'wendelin' prefix and the
      import goes as just '.bigarray' instead of 'wendelin.bigarray' which
      leads to further crash in get_module_part.
      
      -> Fix it by initializing wendelin module yielded by wendelin_transform
      with .name set. Not sure why it is working longer imports without that.
      
      Without the fix added test breaks as
      
          .../instance/slappart5/bin$ ./runUnitTest -v -v -v  testDynamicClassGeneration.TestZodbModuleComponent
          ...
          Running Unit tests of <class 'testDynamicClassGeneration.TestZodbModuleComponent'>
          ok
          testImportVersionedComponentOnly (testDynamicClassGeneration.TestZodbModuleComponent) ... ok
          testInvalidId (testDynamicClassGeneration.TestZodbModuleComponent) ... ok
          testInvalidSourceCode (testDynamicClassGeneration.TestZodbModuleComponent) ... ok
          testModuleSecurityInfo (testDynamicClassGeneration.TestZodbModuleComponent) ... ok
          testPylint (testDynamicClassGeneration.TestZodbModuleComponent) ... FAIL
          testPylintAstroidModuleGeneratedOnce (testDynamicClassGeneration.TestZodbModuleComponent) ... ok
          testPylintNamedtupleUnicodeLiteralsRegression (testDynamicClassGeneration.TestZodbModuleComponent) ... ok
          testReferenceWithReservedKeywords (testDynamicClassGeneration.TestZodbModuleComponent) ... ok
          testValidateInvalidateDelete (testDynamicClassGeneration.TestZodbModuleComponent) ... ok
          testVersionPriority (testDynamicClassGeneration.TestZodbModuleComponent) ... ok
          testVersionWithReservedKeywords (testDynamicClassGeneration.TestZodbModuleComponent) ... ok
          testWorkflowErrorMessage (testDynamicClassGeneration.TestZodbModuleComponent)
          Check that validation error messages are stored in workflow ... ok
      
          ======================================================================
          FAIL: testPylint (testDynamicClassGeneration.TestZodbModuleComponent)
          ----------------------------------------------------------------------
          Traceback (most recent call last):
            File ".../parts/erp5/Products/ERP5Type/tests/testDynamicClassGeneration.py", line 2347, in testPylint
              component.checkSourceCode()
            File ".../parts/erp5/product/ERP5Type/mixin/component.py", line 329, in checkSourceCode
              return checkPythonSourceCode(self.getTextContent(), self.getPortalType())
            File ".../parts/erp5/product/ERP5Type/Utils.py", line 540, in checkPythonSourceCode
              Run(args, reporter=TextReporter(output_file), exit=False)
            File ".../develop-eggs/pylint-1.4.4+slapospatched002-py2.7.egg/pylint/lint.py", line 1332, in __init__
              linter.check(args)
            File ".../develop-eggs/pylint-1.4.4+slapospatched002-py2.7.egg/pylint/lint.py", line 747, in check
              self._do_check(files_or_modules)
            File ".../develop-eggs/pylint-1.4.4+slapospatched002-py2.7.egg/pylint/lint.py", line 869, in _do_check
              self.check_astroid_module(ast_node, walker, rawcheckers, tokencheckers)
            File ".../develop-eggs/pylint-1.4.4+slapospatched002-py2.7.egg/pylint/lint.py", line 946, in check_astroid_module
              walker.walk(ast_node)
            File ".../develop-eggs/pylint-1.4.4+slapospatched002-py2.7.egg/pylint/utils.py", line 874, in walk
              self.walk(child)
            File ".../develop-eggs/pylint-1.4.4+slapospatched002-py2.7.egg/pylint/utils.py", line 871, in walk
              cb(astroid)
            File ".../develop-eggs/pylint-1.4.4+slapospatched002-py2.7.egg/pylint/checkers/imports.py", line 253, in visit_import
              self._add_imported_module(node, importedmodnode.name)
            File ".../develop-eggs/pylint-1.4.4+slapospatched002-py2.7.egg/pylint/checkers/imports.py", line 319, in _add_imported_module
              importedmodname = get_module_part(importedmodname)
            File ".../develop-eggs/astroid-1.3.8+slapospatched001-py2.7.egg/astroid/modutils.py", line 359, in get_module_part
              'explicit relative import, but no context_file?'
          AssertionError: explicit relative import, but no context_file?
      
          ----------------------------------------------------------------------
          Ran 13 tests in 137.609s
      
          FAILED (failures=1)
      
      /helped-and-reviewed-by @jerome
      /reviewed-on nexedi/erp5!1762
      2506a88a
    • Rafael Monnerat's avatar
      ERP5Security: Add tests · 57fee942
      Rafael Monnerat authored
      57fee942
    • Rafael Monnerat's avatar
      ERP5Security: Add tests for login with an user on the same transaction · 3c45fd35
      Rafael Monnerat authored
        that it was created.
      3c45fd35
    • Rafael Monnerat's avatar
    • Rafael Monnerat's avatar
      ERP5Security: Allow user to login with a user created on the same transaction · d7be2a81
      Rafael Monnerat authored
      This allow during a subscription process, create a user and them create all
      documents using that user w/o rely on proxy roles (keeping good ownership
      across the documents).
      d7be2a81
    • Rafael Monnerat's avatar
      BusinessTemplate: Check the existence of property before re-raise · 845038b1
      Rafael Monnerat authored
        On the automatic upgrade some bt5 (erp5_core) can be upgraded
        before erp5_property_sheets. Since, it isnt a problem if this happens
        if no Mixin configuration is present, it is better directly check the
        existence of the property on the bt5.
      
        In general we expect that erp5_property_sheets is upgraded before any
        other bt5 with TypeMixin definition.
      845038b1
    • Rafael Monnerat's avatar
      erp5_safeimage: Move Mixin definitions to PortalTypeTypeMixin · 02b3f6f2
      Rafael Monnerat authored
             Use the proper way to include Mixin into a portal type
      02b3f6f2
    • Rafael Monnerat's avatar
      erp5_hr_calendar: Move Mixin definitions to PortalTypeTypeMixin · 630882d3
      Rafael Monnerat authored
         Use the proper way to include Mixin into a portal type
      630882d3
    • Rafael Monnerat's avatar
      *: Remove empty type_mixin definition from portal types · 86b85a71
      Rafael Monnerat authored
        This value isnt exported anymore
      86b85a71
    • Rafael Monnerat's avatar
      BusinessTemplate: Do not export type_mixin along with the portal type · 434478ac
      Rafael Monnerat authored
       Handle type_mixin like property_sheets and use Business Template properly
      434478ac
    • Rafael Monnerat's avatar
    • Rafael Monnerat's avatar
      BusinessTemplate: Allow set individual Mixins on Portal Types · 51238866
      Rafael Monnerat authored
        Allow the developer associate a Mixin on Business template level
      without require to overwrite the portal type itself
      
        Include mixins can be done in the same way, allowed content types or
      property sheets are set.
      51238866
    • Jérome Perrin's avatar
      *: use getPortalObject directly · 56a6b831
      Jérome Perrin authored
      Products.CMFCore's version 2.7.0 of portal_url.getPortalObject
      returns the portal in an incomplete acquisition context, which
      causes issues when the site is registered as ISiteRoot utility
      (the typical error being AttributeError REQUEST)
      
      ERP5Site.getPortalObject works just fine and is used in many
      places, this commit replaces all occurences of
      portal_url.getPortalObject by getPortalObject.
      56a6b831
    • Jérome Perrin's avatar
      xhtml_style: delete FCKeditor connectors for CPS and Plone · 6adbbec5
      Jérome Perrin authored
      we don't use these
      6adbbec5
    • Jérome Perrin's avatar
      ERP5Site: unregister the portal as ISiteRoot utility · 4ba4c5ff
      Jérome Perrin authored
      Some old ERP5 site were registered as ISiteRoot and this cause
      issues with Products.CMFCore update 2.2.10 -> 2.7
      4ba4c5ff
    • Jérome Perrin's avatar
      pylint: don't report __traceback_info__ as unused variable · 53f3a82c
      Jérome Perrin authored
      this is a "magic" local variable used to add more debugging information
      in zope traceback, it's not supposed to be used directly so it was a
      false positive in our case.
      
      This extends the default value of --dummy-variable-rgx that was defined
      to _$|dummy in pylint 1.4.4 (
      https://github.com/PyCQA/pylint/blob/pylint-1.4.4/pylint/checkers/variables.py#L296
      )
      53f3a82c
    • Jérome Perrin's avatar
      ListBox: ignore non string request keys · ecd6175c
      Jérome Perrin authored
      This can happen when request is used as a cache storage, especially
      after eab00f14 (deferred_style: Properly keep request parameters,
      2021-03-10)
      ecd6175c
    • Rafael Monnerat's avatar
      erp5_crm: This script requires proxy roles when setSource · 15a7884e
      Rafael Monnerat authored
      It the user don't have fully permission on the object (already changed state), this set will fail to check if source should be defined.
      15a7884e
    • Romain Courteaud's avatar
      Proxy role is needed to access the site message context. · 27af93a4
      Romain Courteaud authored
      Conflicts:
      	bt5/erp5_crm/bt/revision
      27af93a4
    • Alain Takoudjou's avatar
    • Jérome Perrin's avatar
      core_test: more Localizer tests · 86aad4a0
      Jérome Perrin authored
      and adjust the test for better python3 compatibility
      86aad4a0
    • Jérome Perrin's avatar
      only_office: use a script for default value · 30229708
      Jérome Perrin authored
      This TALES is complex, especially if we need to support python3 as well
      30229708
    • Jérome Perrin's avatar
      ERP5Form: improve ZMI view of more forms · 29d78c15
      Jérome Perrin authored
      29d78c15
    • Jérome Perrin's avatar
      budget: add proxy role on interaction script · 0f55d00e
      Jérome Perrin authored
      this interaction adjust membership criterions when variation
      categories is changed, but we don't really need security
      restriction in the interaction, because security is already
      checked when setting variation categories.
      0f55d00e
    • Jérome Perrin's avatar
      budget: fix NodeBudgetVariation with same categories as variation · 790a95a2
      Jérome Perrin authored
      This factorize code and fix a problem that when the variation
      category was a Category from the same variation base category,
      we had the base category twice ( something like
      group/group/nexedi )
      790a95a2
    • Jérome Perrin's avatar
      budget: allow Categories in node budget variation relation field · 56e5d38d
      Jérome Perrin authored
      We have been using scripts returning categories but it was
      missing in the relation field.
      56e5d38d
    • Jérome Perrin's avatar
      budget: define BudgetCell.hasCellContent · 03cc66a0
      Jérome Perrin authored
      otherwise it is acquired from BudgetLine, which is bad because:
      - the value of catalog.has_cell_content will be wrong
      - hasCellContent is slow and this was called for all cells in a budget line
      03cc66a0
    • Levin Zimmermann's avatar
      98425592
    • Levin Zimmermann's avatar
      erp5_core_test += Test '.astype('M8[ms]')' (numpy) · 41483d1e
      Levin Zimmermann authored
      In nexedi/erp5@79fa584e we moved
      some security definition from wendelin to erp5, but we didn't add any
      tests anywhere. Recent project based tests revealed that this
      migration actually failed [1]. We should therefore add a test for
      this.
      
      [1] nexedi/wendelin@f8678468 (comment 181134)
      
      /reviewed-on nexedi/erp5!1757
      41483d1e
    • Arnaud Fontaine's avatar
      ERP5Workflow: Move StateChangeInfo from DCWorkflow.Expression to ERP5Workflow. · 6d96ad78
      Arnaud Fontaine authored
      This reduces dependency on DCWorkflow and cleanup StateChangeInfo monkey patch.
      6d96ad78
    • Rafael Monnerat's avatar
    • Rafael Monnerat's avatar
      erp5_credential: Update default from 10yr to infinite · d1e1030a
      Rafael Monnerat authored
         On the implementation 0 dont set stop date on the Assignment
      d1e1030a
    • Rafael Monnerat's avatar
      erp5_credential: Allow create assignments with infinite duration · 17036e45
      Rafael Monnerat authored
        If preferences sets a negative duration, don't set stop/start dates on
      assignments.
      17036e45
    • Arnaud Fontaine's avatar
      patches: DCWorkflowGraph is only for legacy DCWorkflow. · f91a3174
      Arnaud Fontaine authored
      And the Product was removed in recent ERP5 SR.
      f91a3174
    • Jérome Perrin's avatar
      patches: drop zope.contenttype patch · f63a9428
      Jérome Perrin authored
      This patch seems not needed
      f63a9428
    • Jérome Perrin's avatar
      patches: modernize OFSHistory patch · 8c0c44e4
      Jérome Perrin authored
      8c0c44e4
    • Jérome Perrin's avatar
      patches/OFSPdata: drop getLastPdata patch · 414edf53
      Jérome Perrin authored
      This is in SyncMLUtils
      414edf53
    • Jérome Perrin's avatar
      patches: remove States patch · 917fae11
      Jérome Perrin authored
      Now this is defined from new workflows, we no longer need the
      DCWorkflow version
      917fae11
    • Jérome Perrin's avatar
      patches: remove addPossibleTransition API on workflow · 26fd8818
      Jérome Perrin authored
      This was only useful during the transition to ERP5 Workflow, now
      that workflows are migrated, Category API (setDestination) is more
      natural, so there's no reason to keep this patch
      26fd8818