1. 12 Jul, 2022 4 commits
    • Jérome Perrin's avatar
      ERP5Type/tests: support Zope4's Testing.makerequest.makerequest · b9d9c26a
      Jérome Perrin authored
      On Zope2, there was support for starting a ZServer (in
      Testing.ZopeTestCase.utils.startZServer) and there was another makerequest
      (in Testing.ZopeTestCase.utils.makerequest) which had knowledge of this
      ZServer address. We are using our own implementation of startZServer,
      which also knows how to start a WSGI server, but we we were interacting
      with Testing.ZopeTestCase.utils so that its makerequest knows about
      our web server.
      
      On Zope4 there is no utility to start an http server from the tests and
      the makerequest is also gone.
      
      This revisits the web server from test interaction with makerequest:
       - no longer use PortalTestCase._app which creates an app with a request
         to http://nohost, but implement our own _app which creates a request
         to our web server
        - store our server address as class attributes on ProcessingNodeTestCase
         instead of patching pseudo constants in utils (these pseudo constants
         no longer exist)
        - in the case of ERP5TypeLiveTestCase, also rewrap the site to use a
        request to our web server (which was done on Zope2 by using
        Testing.ZopeTestCase.utils.makerequest and not
        Testing.makerequest.makerequest directly)
      b9d9c26a
    • Jérome Perrin's avatar
      ERP5TypeLiveTestCase: close request at the end of each test · 9f5d5640
      Jérome Perrin authored
      This is supposed to fix "Should not load state for ${oid of a skin} when
      the connection is closed" sometimes happening with live tests (especially
      when the test self.publish and the developer access the site while the
      test is suspended on a debugger breakpoint).
      
      The object accessed after the connection is closed was a skin (python
      script, sometimes page template or form) that was cached in SKINDATA.
      The mechanism to prune entries from the cache uses REQUEST.hold API
      which expects that REQUEST.close is called on request, but because
      requests were not closed at the end of the request, it happened that
      the cache was reused from another connection.
      
      This change to close the requests, like ERP5TypeTestCase is doing in
      tearDown (the actual close is done by Testing.ZopeTestCase.connections).
      
      By closing requests at the end of tests, we also have to change so that
      at the beginning of the test we initialize the request, by using the same
      setSite and setupCurrentSkin that are done in ERP5TypeTestCase.
      9f5d5640
    • Jérome Perrin's avatar
      zope4py2: remove a debugging pdb · 789c4325
      Jérome Perrin authored
      789c4325
    • Jérome Perrin's avatar
      Revert "zope4py2: fix usage of _Z2HOST" · b67b3db4
      Jérome Perrin authored
      This reverts commit 3db20ae6
      and commit 948d8b57.
      
      This commit and the fixup were not good, reverting to make a proper
      commit
      b67b3db4
  2. 04 Jul, 2022 1 commit
    • Jérome Perrin's avatar
      squash! zope4py2: fix usage of _Z2HOST · 3db20ae6
      Jérome Perrin authored
      _Z2HOST / _Z2PORT no longer exist in Zope4, something was added in
      component/egg-patch/Zope/0001-OFS-XMLExportImport.patch in SlapOS
      software release, but we never had a strong need to patch there, we
      were doing this so that Testing.ZopeTestCase.utils.makerequest creates
      a REQUEST to this host:port, but now that Zope's startZServer no longer,
      the REQUEST created by Testing.ZopeTestCase.base.app is always to
      nohost:80, so we need to rewrap the app in request to our host:port.
      3db20ae6
  3. 02 Jul, 2022 2 commits
  4. 01 Jul, 2022 2 commits
  5. 27 Jun, 2022 3 commits
  6. 24 Jun, 2022 1 commit
  7. 23 Jun, 2022 2 commits
  8. 22 Jun, 2022 3 commits
  9. 21 Jun, 2022 4 commits
  10. 20 Jun, 2022 2 commits
  11. 15 Jun, 2022 10 commits
  12. 14 Jun, 2022 4 commits
  13. 13 Jun, 2022 2 commits
    • Jérome Perrin's avatar
      dms: disable open button in PDF viewer · c54c4bc0
      Jérome Perrin authored
      It does not make any sense to open PDF files from this gadget.
      
      Also remove duplicate line with documentProperties
      c54c4bc0
    • Jérome Perrin's avatar
      dms: support password protected PDFs in viewer · 407b7727
      Jérome Perrin authored
      This is intended to store sensitive documents that users will only
      be able to view from ERP5, but not to easily print or download.
      
      To use this, some customization is needed. First, PDF needs to be
      saved with a password. Then, PDF_getContentPassword type based method
      needs to be customized to return the password.
      
      When using this, we use different password for each document, by
      deriving a password from a master key using document properties (such
      as document reference for example)
      407b7727