An error occurred fetching the project authors.
  1. 14 Jan, 2025 1 commit
  2. 15 Oct, 2024 1 commit
    • Jérome Perrin's avatar
      py2/py3: Make Products code compatible with both python2 and python3 (nexedi/erp5!1751). · 1b555dbf
      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>
      1b555dbf
  3. 10 Sep, 2024 1 commit
  4. 19 Mar, 2024 1 commit
  5. 05 Mar, 2024 1 commit
    • Jérome Perrin's avatar
      SQLCatalog: keep the order when building query from AST · ea3be761
      Jérome Perrin authored
      When searching for something like for example "A AND B", make sure that
      the AND complex query contains query for ["A", "B"], not ["B", "A"].
      This is probably always equivalent in generated SQL, but this makes
      testing easier.
      
      Revealed by testSQLCatalog.TestSQLCatalog with PYTHONHASHSEED 279 on py2
      ea3be761
  6. 21 Feb, 2024 1 commit
  7. 08 Mar, 2023 1 commit
  8. 03 Mar, 2023 2 commits
  9. 28 Nov, 2022 1 commit
    • Julien Muchembled's avatar
      ZSQLCatalog: fix buildQuery with explicit search key and dict value · f269e6ca
      Julien Muchembled authored
      This fixes things like:
        portal_catalog(source_reference={'query':'foo OR bar', 'key':'KeywordKey'})
      or:
        portal_catalog(query=AutoQuery(source_reference='foo OR bar', key='KeywordKey'))
      
      So we get:
        (`...`.`reference` LIKE '%foo%' OR `...`.`reference` LIKE '%bar%')
      
      instead of:
        `...`.`reference` IN ('{\'query\': \'foo\', \'key\': \'KeywordKey\'}',
                              '{\'query\': \'bar\', \'key\': \'KeywordKey\'}')
      
      Also, remove default values as it makes it easy for caller to leave arguments
      out by mistake.
      Also, use positional arguments as they are faster than named arguments.
      
      See merge request nexedi/erp5!1698
      f269e6ca
  10. 28 Sep, 2022 1 commit
  11. 24 May, 2022 1 commit
    • Jérome Perrin's avatar
      *: keep using func_code and not yet __code__ with scripts · eaae74a0
      Jérome Perrin authored
      On Zope2, python scripts do not have __code__, they only have
      func_code (and same for __defauls__/func_defaults).
      We tried to backport the support of __code__ from Zope4 as a Zope2
      patch - it was SlapOS patch 4fa33dfc6 (erp5: py3: `func_{code,defaults}`
      was replaced in Python3 by `__{code,defaults}__`., 2022-04-25),
      but this patch was incomplete. We tried to backport more, but then
      realized that we don't need to use __code__ on ERP5 master yet,
      because ERP5 master branch is still supporting Zope2 only.
      
      This patch revert a small part of a17bb910 (py2/py3: Make Products
      code compatible with both python2 and python3., 2022-04-13), the part
      where we use f.__code__ where f might be a python script. For now,
      we'll apply this patch only on the Zope4 branch.
      
      A few places where f.func_code was used and f was a for sure not a
      python script but a simple class method or function are kept here, as
      __code__ support is missing only on in ZODB scripts.
      eaae74a0
  12. 04 May, 2022 1 commit
    • Arnaud Fontaine's avatar
      py2/py3: Make Products code compatible with both python2 and python3. · a17bb910
      Arnaud Fontaine authored
      Done through various 2to3 fixers (zope.fixers, modernize, future) and manual
      changes. This is a single commit so that we have a clearer picture of how code
      converted with my2to3 should look like.
      
      Except straightforward @implementer decorator 2to3 fixer, only product/ folder
      was considered as the goal was to be able to create an ERP5Site.
      
      * Use @implementer decorator introduced in zope.interface 3.6.0 (2010):
      
        The implements syntax used under Python 2.X does not work under 3.X, since it
        depends on how metaclasses are implemented and this has changed. Instead it
        now supports a decorator syntax (also under Python 2.X).
      
        Applied thanks to 2to3 `zope.fixers` package.
      
      * Use `six.moves` rather than `future` install_aliases() feature because the
        latter use unicode_literals and "wraps" module aliases so that unicode() are
        returned for text rather than str() (Python2 standard library). This notably
        breaks BusinessTemplate code which uses urllib quote() for filesystem paths...
      
      * No more unbound methods in python3 so use six.get_unbound_function().
      
      * dict.(iteritems,iterkeys,itervalues)() => six.\1(dict) thanks to `dict_six`
        2to3 fixer from `modernize`:
        $ python-modernize -w -f dict_six product/
      
      * Manually make sure that dict.{items,values,keys}() returns a real list when it
        is latter modified rather than a dict_{items,values,keys} (ensure_list()). By
        default, 2to3 blindly does list(dict.{items,values,keys}()) which is not
        acceptable from performances point of view. With my2to3, this will be possible
        to handle such case automatically.
      
      * Replace cStringIO.StringIO() by six.moves.cStringIO() (a module alias for
        cStringIO.StringIO() on py2 and io.StringIO() on py3).
      
      * Use six.text_type which maps to unicode() on py2 and str() on py3. This also
        makes a clearer difference between text and binary strings.
      
      * Replace map()/filter() with lambda function by list comprehension (this has
        the benefit to avoid casting to list for py3 as it returns iterators).
      a17bb910
  13. 29 Apr, 2021 1 commit
  14. 27 Nov, 2019 1 commit
  15. 07 Nov, 2019 5 commits
  16. 06 Nov, 2019 1 commit
  17. 13 Sep, 2019 1 commit
  18. 10 Sep, 2019 1 commit
    • Jérome Perrin's avatar
      ZSQLCatalog: use _getProperty to skip security checks · 16aa6134
      Jérome Perrin authored
      During indexation we don't apply security checks, so this should be a
      little bit faster.
      
      With this change _getProperty becomes a more "official" API, so some
      small changes had to be made to classes which do not inherits from
      Products.ERP5Type.Base.Base, so that they also implements _getProperty:
       - for ERP5Site we simply use getProperty
       - for the test class from testERP5Catalog, the change is a bit more
      important, because this class never defined getProperty, so during that
      test we were just acquiring a getProperty from portal.
      16aa6134
  19. 15 May, 2019 1 commit
    • Vincent Pelletier's avatar
      ZSQLCatalog.SQLCatalog: Stop updating _max_uid . · 2eb01519
      Vincent Pelletier authored
      Even if it does not lead to ConflictError being raised, updating _max_uid
      has a cost and a transaction-serialising effect (most noticeable with NEO).
      This value is not used (outside of a bootstrap value for portal_ids
      generator), so stop doing this unnecessary work.
      Also, fold produceUid into its only caller.
      Also, change the folded pattern to react to an empty buffer rather than
      test for emptiness before each access.
      2eb01519
  20. 26 Mar, 2019 2 commits
  21. 07 Dec, 2018 1 commit
  22. 03 Sep, 2018 1 commit
  23. 01 Sep, 2018 3 commits
  24. 20 Mar, 2018 5 commits
    • Vincent Pelletier's avatar
      SQLCatalog: Simplify and factorise _getCatalogMethodArgumentList · 21d87cd4
      Vincent Pelletier authored
      Document why this method tolerates unhandled method types.
      21d87cd4
    • Vincent Pelletier's avatar
      ZSQLCatalog: Stop hiding possible duplicates in z_getitem_by_{path,uid} · 6bbe51d8
      Vincent Pelletier authored
      LIMIT hides duplicates. We want to know if we ever violate the
      soft-constraint of path unicity in catalog, so stop setting a LIMIT.
      Also, for uid lookup, LIMIT is meaningless as this is ha hard unicity
      constraint (must be enforced by relational database for ERP5 to work).
      
      Also, simplify both the DTML and the SQL by having fewer ways to be
      invoked (backward-compatible).
      6bbe51d8
    • Vincent Pelletier's avatar
      ZSQLCatalog: Make _reindexObjectList tolerate duplicate documents · 667c91df
      Vincent Pelletier authored
      When _reindexObjectList receives a document more than once (which may
      happen when multiple different-tag indexation activities are spawned for
      the same document), it would emit a meaningless error, saying that
      document /foo/bar stole the uid of document /foo/bar.
      Instead, fix duplicate tracking and skip such dulicates.
      
      Also, simplify & make _reindexObjectList more robust:
      - Always check path length.
      - Allocate uids before looking for duplicates in catalog (it may not be
        actually needed at this level nowadays).
      - Always check both uid-to-path and path-to-uid mappings.
      - Reuse existing mappings to detect duplicates among objects being reindexed,
        removing the need for assigned_uid_dict.
      - Avoid computing path more than once, as it's expensive.
      667c91df
    • Vincent Pelletier's avatar
      ZSQLCatalog: Drop support for "reserved" path. · 69aefdff
      Vincent Pelletier authored
      ZSQLCatalog now requires having portal_ids.
      Keep support for clearing existing ones.
      
      Any existing "reserved" row encountered while indexing documents will be
      treated as a uid being attributed to more than one path.
      69aefdff
    • Vincent Pelletier's avatar
  25. 22 Jan, 2018 1 commit
  26. 11 Dec, 2017 1 commit
  27. 30 Nov, 2017 1 commit
  28. 20 Nov, 2017 1 commit
    • Ayush Tiwari's avatar
      Products.ERP5Catalog: EPR5-ify catalog. · 557c20bd
      Ayush Tiwari authored
      Move from SQLCatalog to ERP5Catalog as the default Catalog inside ERP5.
      The major difference is use of Products.ERP5Type.Core.Folder as Catalog
      base class.
      
      Significant addition/changes in
      -------------------------------
      
        ERP5Catalog class:
          Inherit from Catalog class from Products.ZSQLCatalog.SQLCatalog instead of copy-pasting the whole code again.
          Monkey patch some property setters and getters to maintain consistency
          Override getCatalogMethodIds cause it uses global variable in SQLCatalog.Catalog
          Add FilterDict and Filter class to have consistency with `filter_dict` attribute of SQLCatalog
      
        BusinessTemplate:
          Update BusinessTemplate installation with updated filter_dict
          Also, use dynamic migration while installing the catalog method objects for
          bt5. This way we have SQL Methods migrated just after installation.
      
        Tests:
          Update tests according to changes in portal_catalog
      
        SQLCatalog, testZSQLCatalog:
          Cleanup for unusable functions
      557c20bd