1. 03 Mar, 2023 16 commits
    • Jérome Perrin's avatar
    • Jérome Perrin's avatar
      patches: add a compatibility patch for `zope_quick_start` · b5b7e626
      Jérome Perrin authored
      `zope_quick_start` was a dtml that was removed in Zope commit c8e4cd5ca
      (Simplify control panel objects and actually make them non-persistent.,
      2016-08-14), but it is referenced in /index_html page template, which
      contains:
      
          <tal:text tal:replace="structure context/zope_quick_start" />
      
      As a result, rendering / is an error page because of KeyError: 'zope_quick_start'
      
      In SlapOS setup, we are using / in an haproxy health check, so the
      health check fail and zope is marked as down and haproxy does not send
      requests to backend.
      
      We could have an upgrader constraint to repair this page template, but
      because of this, zope is unreachable through haproxy, so it's easier to
      ressort to monkey patching.
      b5b7e626
    • Tatuya Kamada's avatar
      ERP5Catalog: Fix UnicodeDecodeError on non ascii catalog search when the inituser name is unicode · 9dfc715d
      Tatuya Kamada authored
      Zope4 inituser is decoded by decode('utf-8') on Zope startup and it is unicode on python2,
      therefore it raises UnicodeDecodeError when searching non ascii charater on catalog.
      
        Traceback (most recent call last):
        File "<portal_components/test.erp5.testERP5Catalog>", line 4144, in testSearchNonAsciiWithTheInitUser
          person_module.searchFolder(title=person_title)]
        File "./erp5/product/ERP5Type/Core/Folder.py", line 452, in searchFolder
          return self.portal_catalog.searchResults(**kw)
        File "./erp5/product/ERP5Catalog/CatalogTool.py", line 819, in searchResults
          return ZCatalog.searchResults(self, sql_catalog_id=catalog_id, **kw)
        File "./erp5/product/ZSQLCatalog/ZSQLCatalog.py", line 1070, in searchResults
          return catalog.searchResults(REQUEST, **kw)
        File "./erp5/product/ZSQLCatalog/SQLCatalog.py", line 2362, in searchResults
          **kw
        File "./erp5/product/ZSQLCatalog/SQLCatalog.py", line 2326, in queryResults
          **kw
        File "./erp5/product/ZSQLCatalog/SQLCatalog.py", line 2214, in buildSQLQuery
          only_group_columns,
        File "./erp5/product/ZSQLCatalog/SQLExpression.py", line 397, in asSQLExpressionDict
          'where_expression': self.getWhereExpression(),
        File "./erp5/product/ZSQLCatalog/SQLExpression.py", line 298, in getWhereExpression
          result = self.sql_expression_list[0].getWhereExpression()
        File "./erp5/product/ZSQLCatalog/SQLExpression.py", line 303, in getWhereExpression
          result = '(%s)' % (operator.join(x.getWhereExpression() for x in self.sql_expression_list), )
        UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 25: ordinal not in range(128)
      9dfc715d
    • Jérome Perrin's avatar
      xhtml_style: don't set content type header if already set · 67bf561b
      Jérome Perrin authored
      This is necessary on Zope4 because the error page is executed even if
      the response already has a locked body - and in this case we don't
      want to override the content-type header that might also have been set.
      
      One user of this is Base_redirect from erp5_hal_json_style, when
      abort_transaction is True, in that case it sets a body in json, a
      content type header of application/json and then raise a redirect so
      that the transaction is not commited. This fixes a problem visible on
      Zope4 with erp5_bank_reconciliation_renderjs_ui_test:testFunctionalRJSBankReconciliationAction
      67bf561b
    • Jérome Perrin's avatar
      hal_json_style/Base_redirect: pass an URL to Redirect · 44305dbb
      Jérome Perrin authored
      Even if this is not used because we have locked a status earlier, the
      constructor expects an URL with zExceptions 4
      44305dbb
    • Jérome Perrin's avatar
    • Jérome Perrin's avatar
      patches/CookieCrumbler: apply upstream changes · 47a5db6e
      Jérome Perrin authored
      zopefoundation/Products.CMFCore commit 882a697 (- correct check for
      request compatibility for CookieCrumbler, 2017-05-12)
      47a5db6e
    • Jérome Perrin's avatar
      279b1af9
    • Jérome Perrin's avatar
      oauth_facebook_login: update # hack to be compatible with Zope4 redirects · 3e8c99ca
      Jérome Perrin authored
      Zope4 uses urlparse + urlunparse to encode the URL, which has a side
      effect of removing the empty fragment from the URL. Using a lower level
      API to set the status code and the Location header we achieve the same
      result.
      3e8c99ca
    • Jérome Perrin's avatar
      ERP5Type/tests: support Zope4's Testing.makerequest.makerequest · e216cccd
      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)
      e216cccd
    • Jérome Perrin's avatar
      PortalTransforms: update transforms/rest for zope4 compatibility · cee77c11
      Jérome Perrin authored
      Update to https://github.com/plone/Products.PortalTransforms/blob/3.2.0/Products/PortalTransforms/transforms/rest.py
      because Zope4 no longer ship with a reStructuredText module and recommend
      using docutils directly instead, which is what upstream did.
      
      ( in zope4py2 branch this was working because slapos patch
      component/egg-patch/Zope/0001-OFS-XMLExportImport.patch used to bring
      back reStructuredText but we don't seem to need it )
      cee77c11
    • Jérome Perrin's avatar
    • Jérome Perrin's avatar
      patches/WSGIPublisher: update patch for Zope4 · 5b042ba3
      Jérome Perrin authored
      Zope2 did not have WSGIPublisher, this patch was a backport of the
      module from Zope 4. Now that we use Zope 4, we no longer need to copy
      the module code, but we still need a patch to apply the deadline patch.
      5b042ba3
    • Aurel's avatar
      xhtml_style: adjust standard_error_message for Zope4 · e50a6133
      Aurel authored
      There are some few differences:
      
      In Zope4 exceptions are callable, but we don't want to call them here,
      so we use a python: expression instead of the path expression which
      tries to call error_value.
      
      error_message is sometimes not passed.
      
      The context is different: Since Zope 4, the `standard_error_message` is
      rendered in the context of REQUEST['PUBLISHED'], which in case of
      publishing a skin (page template or script) in the context of a document
      is is the skin itself, but for error rendering in case of erp5_web Web
      Site or Web Section, we expect standard_error_message_template to always
      be rendered in the context of the document, that's why we use
      REQUEST.PARENTS[0] as context.
      
        REQUEST.PUBLISHED = <PythonScript at /erp5/script used for /erp5/module/document>
        REQUEST.PARENTS [<Document>, <Module>, <ERP5Site>, ...]
      
      In case of redirect, the body is no longer empty, but we explicitly
      return an empty body to keep the same behavior as zope2
      e50a6133
    • Jérome Perrin's avatar
      Revert "*: keep using func_code and not yet __code__ with scripts" · d2af3276
      Jérome Perrin authored
      This reverts commit eaae74a0.
      
      On Zope4 branch we are ready to use __code__
      d2af3276
    • Aurel's avatar
      fixup! a17bb910 use unichr instead of chr · 63e63f60
      Aurel authored
      63e63f60
  2. 02 Mar, 2023 24 commits