1. 12 Sep, 2024 9 commits
    • Jérome Perrin's avatar
      fixup! py3: _mysql.string_literal() returns bytes(). · a8e65b20
      Jérome Perrin authored
      Followup of 94739085.
      a8e65b20
    • Arnaud Fontaine's avatar
      py3: cmp()-based comparison and sorting have been dropped. · 1c924191
      Arnaud Fontaine authored
      key()-based sorting is now used instead, available since Python 2.4.
      1c924191
    • Jérome Perrin's avatar
      erp5_data_notebook: python3 support. · 80ded5a5
      Jérome Perrin authored
      Jupyter integration is more or less abandoned. Just do the minimum to make tests pass.
      80ded5a5
    • Jérome Perrin's avatar
      py3: Fix pylint/SyntaxWarning warnings. · e3afb300
      Jérome Perrin authored
      Also, remove `if True/1/False/0` statement raising pylint warnings.
      Co-authored-by: Arnaud Fontaine's avatarArnaud Fontaine <arnaud.fontaine@nexedi.com>
      e3afb300
    • Jérome Perrin's avatar
      py2/py3: Make Products code compatible with both python2 and python3. · 8d13818b
      Jérome Perrin authored
      * Zope API changes:
        + publish():
          - stdin is now BytesIO rather than StringIO.
          - Returned value of a script is passed to str() in python2, not in python3 anymore.
        + HTTPResponse `body` property is now bytes().
        + OFS.Image.File file parameter is bytes().
        + zope.interface implements() is now @implementer decorator.
        + Python standard logging module recommended instead of zLOG.
      * Python3 API changes:
        + builtin reduce() was removed.
        + urlnorm is now available.
        + Use BytesIO rather than StringIO to follow py3 API.
        + hmac.new() requires digestmod argument from Python 3.8.
        + Use six.moves library to handle moved objects from py2 to py3.
        + `modernize -f xrange_six` then slightly adjusted manually to just use range
           where it does not make a significant difference (for example in test).
        + base64.b64encode() now expects bytes().
        + UserDict() interface changed:
          - New parameter in update() and pop().
          - `failobj` setdefault parameter renamed to `default`.
        + ensure_list() on dict.{values,items}() and list(dict) for dict.keys() when
          we really need a list and not an iterable (Python3).
          - Add ensure_list() to RestrictedPython safe_builtins as it's very common usage.
        + Make dict iteration works on both version of Python.
          - Use six.iter{items,values,keys}().
          - has_key() has been removed.
          - Make sure that dict.{items,values,keys}() returns a real list when
          modified (ensure_list()).
        + Comparisons between int and NoneType raises TypeError.
          + BTrees key must be str() not int() (_getOb()).
        + No more unbound methods in python3 so use six.get_unbound_function().
        + Exceptions:
          - No longer behave as sequences. Using `args` attribute instead.
          - When an exception has been assigned using `as target`, it is cleared at
            the end of the except clause.
        + file: py2 was returning `str` upon reading, now it returns text strings.
          Also, opening mode is text strings by default.
        + Data strings are bytes().
          - Replace str() by bytes().
        + iterators no longer have next() method, instead there is next() builtin.
        + New ConnectionError exception so rename existing one to not clash.
        + Integer division is now with //.
        + __nonzero__ is now __bool__.
        + apply() does not exist anymore.
        + Deprecated threading.Thread isAlive() has been removed.
        + im_func replaced by __func__.
        + Use six.with_metaclass() to define metaclass in a cross-compatible way with py2 and py3.
        + Only test method can be marked as expectedFailure(), not assert statement anymore.
        + os.path.walk() removed.
        + HTMLParser never fails: no strict mode nor HTMLParseError anymore (Python #15114).
      Co-Authored-by: Kazuhiko Shiozaki's avatarKazuhiko SHIOZAKI <kazuhiko@nexedi.com>
      Co-Authored-by: Arnaud Fontaine's avatarArnaud Fontaine <arnaud.fontaine@nexedi.com>
      Co-Authored-by: Carlos Ramos Carreño's avatarCarlos Ramos Carreño <carlos.ramos@nexedi.com>
      Co-Authored-by: Emmy Vouriot's avatarEmmeline Vouriot <emmeline.vouriot@nexedi.com>
      8d13818b
    • Jérome Perrin's avatar
    • Jérome Perrin's avatar
      base/conversion: setContentType before converting to base format · 48139faa
      Jérome Perrin authored
      some conversion (TextDocument) depend on the content type, so it's
      necessary to first update the content type before trying to convert to
      base format
      48139faa
    • Arnaud Fontaine's avatar
      Remove unused code. · 985f2dca
      Arnaud Fontaine authored
      985f2dca
    • Arnaud Fontaine's avatar
      68d59a03
  2. 11 Sep, 2024 3 commits
    • Arnaud Fontaine's avatar
    • Arnaud Fontaine's avatar
      zope5: Since Zope 5.8.1 CONTENT_TYPE HTTP header must be specified for PUT request. · 636de5ba
      Arnaud Fontaine authored
      Despite RFC 4918 stating that Content-Type *SHOULD* be provided, since the
      following commit no CONTENT_TYPE means application/x-www-form-urlencoded thus
      processing the request as a form and not a binary file (with cgi.FieldStorage,
      it was text/plain and all the form-processing logic was skipped):
        commit 5b324f6c461f5ea1cc069739b6c32a1a5ff59df9
        Date:   Thu Jan 19 07:15:18 2023 +0100
          replace `cgi.FieldStorage` by `multipart` (#1094)
          * interpret a missing `CONTENT_TYPE` as `application/x-www-form-urlencoded`
      
      This raises the following exception:
        Traceback (most recent call last):
          File "erp5://portal_components/test.erp5.testWebDavSupport", line 232, in test_PROPFIND_on_document
            response = self.publish(
          File "/opt/slapgrid/3f9add9291086dee302fc478df4b3130/parts/erp5/product/ERP5Type/tests/ERP5TypeTestCase.py", line 793, in publish
            return super(ERP5TypeTestCaseMixin, self).publish(
          File "/opt/slapgrid/3f9add9291086dee302fc478df4b3130/eggs/Zope-5.10-py3.9.egg/Testing/ZopeTestCase/functional.py", line 42, in wrapped_func
            return func(*args, **kw)
          File "/opt/slapgrid/3f9add9291086dee302fc478df4b3130/eggs/Zope-5.10-py3.9.egg/Testing/ZopeTestCase/functional.py", line 133, in publish
            wsgi_result = publish(env, start_response)
          File "/opt/slapgrid/3f9add9291086dee302fc478df4b3130/eggs/Zope-5.10-py3.9.egg/ZPublisher/httpexceptions.py", line 30, in __call__
            return self.application(environ, start_response)
          File "/opt/slapgrid/3f9add9291086dee302fc478df4b3130/eggs/Zope-5.10-py3.9.egg/ZPublisher/WSGIPublisher.py", line 391, in publish_module
            response = _publish(request, new_mod_info)
          File "/opt/slapgrid/3f9add9291086dee302fc478df4b3130/parts/erp5/product/ERP5Type/patches/WSGIPublisher.py", line 150, in publish
            return _original_publish(request, module_info)
          File "/opt/slapgrid/3f9add9291086dee302fc478df4b3130/eggs/Zope-5.10-py3.9.egg/ZPublisher/WSGIPublisher.py", line 251, in publish
            request.processInputs()
          File "/opt/slapgrid/3f9add9291086dee302fc478df4b3130/parts/erp5/product/Localizer/patches.py", line 37, in new_processInputs
            HTTPRequest.old_processInputs(self)
          File "/opt/slapgrid/3f9add9291086dee302fc478df4b3130/eggs/Zope-5.10-py3.9.egg/ZPublisher/HTTPRequest.py", line 544, in processInputs
            key = item.name.encode("latin-1").decode(
        UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe3 in position 10: invalid continuation byte
      636de5ba
    • Jérome Perrin's avatar
      erp5_stripe: Fix test simulating a webhook request made by stripe. · 614e6ac0
      Jérome Perrin authored
      The real request has the `CONTENT_TYPE` header so do the same in the test. This
      was working anyway without the header on py2 but not on py3.
      614e6ac0
  3. 10 Sep, 2024 7 commits
  4. 09 Sep, 2024 3 commits
  5. 05 Sep, 2024 1 commit
  6. 03 Sep, 2024 5 commits
  7. 31 Aug, 2024 1 commit
  8. 30 Aug, 2024 2 commits
  9. 28 Aug, 2024 1 commit
  10. 27 Aug, 2024 1 commit
  11. 26 Aug, 2024 4 commits
  12. 16 Aug, 2024 1 commit
  13. 14 Aug, 2024 1 commit
  14. 13 Aug, 2024 1 commit