1. 03 Oct, 2024 7 commits
    • Jérome Perrin's avatar
      py2/py3: Make Products code compatible with both python2 and python3. · 811bbd6b
      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).
        + 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).
        + Unpickler.find_global() is now Unpickler.find_class().
      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>
      811bbd6b
    • Jérome Perrin's avatar
    • Jérome Perrin's avatar
      base/conversion: setContentType before converting to base format · e97a6089
      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
      e97a6089
    • Arnaud Fontaine's avatar
      Remove unused code. · e0a57e15
      Arnaud Fontaine authored
      e0a57e15
    • Arnaud Fontaine's avatar
      5db5b5a0
    • Arnaud Fontaine's avatar
    • Arnaud Fontaine's avatar
      zope5: Since 5.8.1 missing Content-Type HTTP header is interpreted as... · 0e3bdb50
      Arnaud Fontaine authored
      zope5: Since 5.8.1 missing Content-Type HTTP header is interpreted as application/x-www-form-urlencoded.
      
      Zope.git:
        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`
      
      With cgi.FieldStorage, it was interpretated as text/plain so Content-Type has to
      be provided now (even for WebDAV despite RFC 4918 stating that it *SHOULD* be
      provided).
      
      Some Unit Tests did not provide such header at all but this was wrong (such as
      erp5_stripe:testStripe where the real request has application/json as
      Content-Type and not text/plain).
      0e3bdb50
  2. 02 Oct, 2024 1 commit
  3. 01 Oct, 2024 1 commit
  4. 30 Sep, 2024 1 commit
  5. 27 Sep, 2024 5 commits
    • Roque's avatar
      Update monitoring app storage · 3982aa81
      Roque authored
      See merge request !1977
      3982aa81
    • Roque's avatar
      erp5_web_monitoring: refactor how app handles data · db9466f8
      Roque authored
      - app does not manipulate data structure anymore (jio does)
      - use union storage for multiple masters
      - remote slapos masters fetch is done in replicateopml storage repair method
      - sync repair method recreates the storage on new master urls, and updates the stored objects accordingly
      - add erp5monitor layer in monitoring jio storage
      db9466f8
    • Roque's avatar
      erp5_officejs: fix error in header rendering · b3c075f1
      Roque authored
      - add notify parameters on controller
      - fix form_view custom submit handling
      b3c075f1
    • Kazuhiko Shiozaki's avatar
      erp5_core: reindex recursively only if indexable children type exists in... · 18e9c69a
      Kazuhiko Shiozaki authored
      erp5_core: reindex recursively only if indexable children type exists in Base_reindexObjectSecurity.
      
      This is important especially for SyncML Subscription having tons of SyncML Signatures that is non-indexable.
      
      Note: first I tried the change in the restricted python only like :
      
      --- product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_reindexObjectSecurity.py
      +++ product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_reindexObjectSecurity.py
      @@ -4,7 +4,8 @@
       # with lots of content could mean hours of non-usable overloaded system.
       type_tool = context.getPortalObject().portal_types
       for portal_type_name in context.getTypeInfo().getTypeAllowedContentTypeList():
      -  if getattr(type_tool, portal_type_name).getTypeAcquireLocalRole():
      +  if getattr(type_tool, portal_type_name).getTypeAcquireLocalRole() and \
      +      type_tool.getPortalTypeClass(portal_type_name).isIndexable():
           reindex = context.recursiveReindexObject
           break
       else:
      
      but I got the following exception :
      
        File "Script (Python)", line 8, in Base_reindexObjectSecurity
          type_tool.getPortalTypeClass(portal_type_name).isIndexable():
        File "/(SR)/eggs/AccessControl-4.4-py2.7-linux-x86_64.egg/AccessControl/users.py", line 179, in allowed
          if self._check_context(object):
        File "/(SR)/parts/erp5/product/ERP5Type/patches/AccessControl_patch.py", line 44, in _check_context
          return aq_inContextOf(getattr(object, '__self__', object), context, 1)
      TypeError: unbound method _aq_dynamic() must be called with Address instance as first argument (got str instance instead)
      18e9c69a
    • Georgios Dagkakis's avatar
      erp5_core: Allow more attributes in gadget_html_viewer.js · 3ec082b3
      Georgios Dagkakis authored
      Plus, remove the duplicate of 'text-align'
      3ec082b3
  6. 26 Sep, 2024 1 commit
    • Jérome Perrin's avatar
      core: fix Flags not at the start of the expression warnings with new mimetypes_registry · b819f8da
      Jérome Perrin authored
      This is follow up of commit 0000dee0 (erp5_core: update
      mimetypes_registry with shared-mime-info_2.4-5 and media-types_10.1.0.,
      2024-09-17), after this change, Products.MimetypesRegistry build regular
      expressions with fnmatch.translate, which on python2 produces regular
      expressions like:
      
           >>> fnmatch.translate('*.aaa')
           '.*\\.aaa\\Z(?ms)
      
      such expressions cause a warning in python3:
      
          >>> re.compile('.*\\.aaa\\Z(?ms)')
          ...
          re.error: global flags not at the start of the expression at position 9
      
      Running this on python3 would be incompatible with python2, because
      `fnmatch.translate` on python3 generates regular expressions that are not
      valid on python2.
      
      To solve this mimetypes_registry.xml was edited by hand to move the
      flags at the beginning, replacing for example '.*\\.aaa\\Z(?ms)' by
      '(?ms).*\\.aaa\\Z'
      b819f8da
  7. 25 Sep, 2024 1 commit
  8. 24 Sep, 2024 3 commits
  9. 23 Sep, 2024 12 commits
  10. 20 Sep, 2024 1 commit
  11. 19 Sep, 2024 4 commits
  12. 18 Sep, 2024 3 commits