1. 11 Mar, 2022 1 commit
    • Jérome Perrin's avatar
      tests: update expected HTML/XML produced by page templates · fd247eeb
      Jérome Perrin authored
      With zope.tal 3.6.0 - commit 26fadc4 (Increase the default value of
      the `wrap` argument from 60 to 1023 characters, to avoid extra
      whitespace and line breaks., 2011-08-20) from zopefoundation/zope.tal -
      page templates keep the attributes on the same line and produce
      slightly different output, although equivalent.
      
      This commit updates the places where we do snapshot testing to the
      new output. We discussed using lxml features to compare html and xml
      from https://lxml.de/lxmlhtml.html#running-html-doctests but because
      the corporate identity web pages are invalid html, it seems unsafe
      to rely on lxml at this point. Once corporate identity web pages
      are fixed this would probably be a good thing to do.
      fd247eeb
  2. 10 Mar, 2022 1 commit
    • Jérome Perrin's avatar
      web_renderjs_ui,officejs: don't use zope's favicon.ico · 32c729f7
      Jérome Perrin authored
      Most service worker precache scripts reference a favicon.ico, but this
      is using the default favicon.ico from Zope and even though it was included
      in all ERP5JS and OfficeJS web sites, this was mostly not used, only
      web_renderjs_ui web pages reference favicon.ico.
      
      There's a favicon.ico in erp5_xhtml_style skin folder, but the skin
      folder is not in ERP5JS skin selection.
      
      On Zope2, this caused ERP5JS and OfficeJS application use the default
      Zope favicon. On Zope4, the service worker can not fill its cache
      because of 404 errors.
      
      To solve this, provide a favicon.ico in ERP5JS skin selection, by
      copying the one from erp5_xhtml_style. We also reference it explicitly in
      web site layout properties so that it remain in the cache.
      
      OfficeJS applications do not use favicon.ico explicitly. They use icons
      in their web application manifest, but this does not seem to be use as
      favicon unless the PWA is installed. This part is not addressed by this
      commit.
      32c729f7
  3. 09 Mar, 2022 3 commits
  4. 03 Mar, 2022 5 commits
  5. 02 Mar, 2022 2 commits
  6. 28 Feb, 2022 7 commits
  7. 26 Feb, 2022 4 commits
  8. 25 Feb, 2022 5 commits
  9. 24 Feb, 2022 12 commits
    • Jérome Perrin's avatar
      patches/ExternalMethod update patch for Zope4 · 0bb5dddb
      Jérome Perrin authored
      In the changes from ExternalMethod 2.13.1 -> 4.5, now ExternalMethod
      define __code__ (and __defaults__) to a computed attribute calling
      getFunction, but getFunction is different in our patched class, so
      when unwrapMethod tries to get __code__, it will raise and mapply
      will not consider the external method as being callable, so a simple
      __repr__ of the ExternalMethod will be used as response body when
      published.
      
      By defining __code__ to something using our patched logic, this
      problem does not happen.
      
      There's also a TODO because DevelopmentMode is now True, which uses
      a different code path which was causing TypeError, because getPath
      returns None, which os.stat does not accept.
      0bb5dddb
    • Xiaowu Zhang's avatar
      2d0c1169
    • Vincent Pelletier's avatar
    • Vincent Pelletier's avatar
      erp5_core_test testERP5Catalog: Do not compare creation_date with modificatoin_date · c06e2069
      Vincent Pelletier authored
      Creation date is defined as the oldest date of any workflow history on the
      considered document.
      Modification date is defined as the newest date of any workflow history
      on the considered document.
      As soon as there is more than one workflow on a given document, these
      values can differ: they are set with the wall-clock time at the moment
      the workflow history of each workflow is initially filled, so one can land
      just before a second change and the other right after.
      So comparing them is meaningless, catalog or not, and just causes this test
      to be unstable.
      c06e2069
    • Jérome Perrin's avatar
      configurator: create account matching constraint · f14403d5
      Jérome Perrin authored
      Because we want to check consistency on all documents created by
      configurator, we also need documents created during the test to be
      consistent (or deleted)
      f14403d5
    • Jérome Perrin's avatar
      *: fix trade phase duplication in erp5_simulation_test and erp5_configurator_standard_categories · 416c6212
      Jérome Perrin authored
      We had trade phase duplication:
       - `trade_phase/default/*` were provided by erp5_simulation_test
       - `trade_phase/trade/*` are provided by erp5_configurator_standard_categories
      
      so the former was only for testing and the later were actually used in
      instance configured by configurator.
      
      But in some paths from configurator_standard_*template, which are also
      used on configurated instances, were using trade_phase/default (the one
      from test). Some rules were referencing these categories, but apparenlty
      not using them.
      
      To fix this confusion, use trade_phase/trade/* everywhere, and install
      erp5_configurator_standard_categories where needed in tests.
      416c6212
    • Jérome Perrin's avatar
      configurator: fix some BusinessConfiguration methods · d4a9d1c3
      Jérome Perrin authored
      BusinessConfiguration have a resource category, but it's the workflow,
      it's not really a resource, so some APIs from the base Amount class are
      not available. Because they have no meaning on BusinessConfiguration
      anyway, define the broken APIs to return nothing.
      
      This fixes errors trying to use check_consistency alarm on Business
      Configurations.
      d4a9d1c3
    • Jérome Perrin's avatar
    • Jérome Perrin's avatar
      administration: Extend check_consistency alarm to check tools as well as modules · 2bc5d232
      Jérome Perrin authored
      Tools also contain documents, so it makes sense to check them as well
      2bc5d232
    • Jérome Perrin's avatar
      *knowledge_pad: fix some gadget instances properties types · 2e00d49f
      Jérome Perrin authored
      These documents were probably edited before they had correct property
      sheets, because they had local properties as incorrect type, as reported
      by PropertyTypeValidity:
      
          <ERP5Type.ConsistencyMessage for PropertyTypeValidity type_check on portal_gadgets/erp5_persons (message: Attribute gadget_type should be of type lines but is of type <type 'str'>)>
          <ERP5Type.ConsistencyMessage for PropertyTypeValidity type_check on portal_gadgets/erp5_gadget_new_sale_opportunity (message: Attribute gadget_type should be of type lines but is of type <type 'str'>)>
          <ERP5Type.ConsistencyMessage for PropertyTypeValidity type_check on portal_gadgets/erp5_gadget_contact_person (message: Attribute gadget_type should be of type lines but is of type <type 'str'>)>
      2e00d49f
    • Jérome Perrin's avatar
    • Jérome Perrin's avatar
      ERP5Security,erp5: simplify EncryptedPasswordMixin.setPassword · b7a60478
      Jérome Perrin authored
      For historical reasons, EncryptedPasswordMixin.setPassword was public
      and did its own security checks, this was the case since 7d0882ef (
      setPassword have to do explicit security checks…, 2007-11-12), this was
      because we wanted to support cases where user can edit the login ("Edit
      portal content" permission), but not changed the password ("Set own
      password" permission).
      
      Also, we wanted to support the case where login is edited through a view
      form, in that case we have a my_password field that is empty and we
      don't want to set the password to None in that case.
      
      For these two reasons the API to set password was very complex and
      behaving differently from other accessors: usually setSomething(None)
      just set something to None, ie. "unset" something, but for passwords it
      was not the case. Also we had to introduce _forceSetPassword method,
      which sets the password without security checks, so that it can be
      called from unrestricted code for cases where user does not have the
      permission to reset password (like in the reset password scenario).
      
      Since d1312cdb ( make edit check the security remove all useless
      security declaration on private method, 2008-05-23), edit supports
      restricted properties, so we can simplify all this and make setPassword
      a more standard accessor, ie:
       - setPassword has a security declaration, so if it is called from
        restricted python the security will apply at `__getattr__` time.
        `edit` method will also check security
       - setPassword(None) reset the password.
       - The logic to not change the password when editing in view mode is now
        `edit` responsability. ie. `login.setPassword(None)` resets, but
        `login.edit(password=None)` does not reset.
      
      This also correct some usage of the lower level API (`pw_encrypt` and
      `pw_validate`) which were never supposed to use `None`:
       - `pw_validate` was called with None when a user without password was
        trying to login, causing a TypeError that was cached by PAS and logged
        with level debug (and refusing login). Now the error is no longer raised.
       - `pw_encrypt` was called with None (but apparently only in the tests,
        when doing `user.newContent(portal_type='ERP5 Login', password=None)`)
        and this was creating a login with password `'None'` with AccessControl 2.
        With AccessControl 4 this was an Error.
      b7a60478