1. 16 Oct, 2024 4 commits
    • Jérome Perrin's avatar
      dms: explicitly cast `path` selected columns to char · ee19f449
      Jérome Perrin authored
      On python3, the type of selected columns depend on the data type from
      mariadb side, VARCHAR will be str, BINARY/BLOB will be bytes, etc
      
      These SQL method select path that is first evaluated from a variable
      that is NULL and in that case, mariadb seems to select LONGBLOB as data
      type:
      
          MariaDB [test]> set @defined_as_null=null; drop table if exists tmp; create table tmp as (select @defined_as_null); show create table tmp;
          +-------+------------------------------------------------------------------------------------------------------------------------------------+
          | Table | Create Table                                                                                                                       |
          +-------+------------------------------------------------------------------------------------------------------------------------------------+
          | tmp   | CREATE TABLE `tmp` (
            `@defined_as_null` longblob DEFAULT NULL
          ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci |
          +-------+------------------------------------------------------------------------------------------------------------------------------------+
      
      By casting to CHAR in SQL, on the python side we always have the str
      that we expect here, because this is used as path attribute of a SQL
      brain.
      ee19f449
    • Jérome Perrin's avatar
      custom_zodb: fix a ResourceWarning · 5349d8c4
      Jérome Perrin authored
      5349d8c4
    • Jérome Perrin's avatar
      ProcessingNodeTestCase: also setRequest in timerserver loop · 6102ed47
      Jérome Perrin authored
      This is similar to 18deb716 (ProcessingNodeTestCase: also setRequest
      in processing_node, 2023-05-02), as said in that commit message,
      timerserver loop calls setRequest, but before entering the loop, we
      wait for the portal to be created with:
      
       447   │           try:
       448   │             self.portal = self.app[self.app.test_portal_name]
       449   │           except (AttributeError, KeyError):
       450   │             continue
      
      While accessing like this, this will load classes and initialize dynamic
      modules, on python2 this was OK, but on python3 this was raising an
      error because `getRequest` returned None:
      
        File "./parts/erp5/product/ERP5Type/dynamic/component_package.py", line 449, in load_module
          return self.__load_module(fullname)
        File "./parts/erp5/product/ERP5Type/dynamic/component_package.py", line 416, in __load_module
          erp5.component.ref_manager.add_module(module)
        File "./parts/erp5/product/ERP5Type/dynamic/dynamic_module.py", line 86, in add_module
          self.add_request(get_request())
        File "./parts/erp5/product/ERP5Type/dynamic/dynamic_module.py", line 64, in add_request
          self.setdefault(last_sync, (WeakSet(), set()))[0].add(request_obj)
        File "./lib/python3.9/_weakrefset.py", line 89, in add
          self.data.add(ref(item, self._remove))
      TypeError: cannot create weak reference to 'NoneType' object
      
      On python2, this was actually raising as well, but this error is hidden
      by a `hasattr`, because on python2 `hasattr` ignores all exceptions and
      on python3 it only ignores only `AttributeError`.
      
        File "./parts/erp5/product/ERP5Type/Core/PropertySheet.py", line 61, in createAccessorHolder
          self.applyOnAccessorHolder(accessor_holder, expression_context, portal)
        File "./parts/erp5/product/ERP5Type/Core/PropertySheet.py", line 175, in applyOnAccessorHolder
          for property_definition in self.contentValues():
        File "./parts/erp5/product/ERP5Type/Core/Folder.py", line 1570, in contentValues
          portal_type_id_list = self._getTypesTool().listContentTypes()
        File "./parts/erp5/product/ERP5Type/Tool/TypesTool.py", line 173, in listContentTypes
          provider_value = _getOb(provider, None)
        File "./eggs/Zope-4.8.7-py2.7.egg/OFS/ObjectManager.py", line 323, in _getOb
          if id[:1] != '_' and hasattr(aq_base(self), id):
        File "./parts/erp5/product/ERP5Type/dynamic/lazy_class.py", line 120, in __getattribute__
          self.__class__.loadClass()
      6102ed47
    • Nicolas Wavrant's avatar
  2. 15 Oct, 2024 21 commits
  3. 14 Oct, 2024 6 commits
  4. 02 Oct, 2024 1 commit
  5. 01 Oct, 2024 1 commit
  6. 30 Sep, 2024 1 commit
  7. 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
  8. 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