1. 17 May, 2022 1 commit
  2. 16 May, 2022 4 commits
    • Julien Muchembled's avatar
      ERP5Type: fix regression in properties.dtml · eef80b9e
      Julien Muchembled authored
      In commit a17bb910 ("py2/py3:
      Make Products code compatible with both python2 and python3"),
      2to3 changed `_.has_key(...)` to `... in _` whereas _ is not a dict.
      
      Traceback (innermost last):
       ...
       Module OFS.PropertyManager, line 309, in manage_editProperties
         manage_tabs_message=message)
       Module Shared.DC.Scripts.Bindings, line 322, in __call__
         return self._bindAndExec(args, kw, None)
       Module Shared.DC.Scripts.Bindings, line 359, in _bindAndExec
         return self._exec(bound_data, args, kw)
       Module App.special_dtml, line 185, in _exec
         try: result = render_blocks(self._v_blocks, ns)
       Module DocumentTemplate.DT_In, line 707, in renderwob
         try: append(render(section, md))
       Module DocumentTemplate.DT_Let, line 76, in render
         else: d[name]=expr(md)
       Module DocumentTemplate.DT_Util, line 210, in eval
        - __traceback_info__: _
         return eval(code, d)
       Module <string>, line 1, in <module>
      
      TypeError: argument of type 'TemplateDict' is not iterable
      eef80b9e
    • Xiaowu Zhang's avatar
      erp5_trade: add product line selection in stock report · 6cbb159d
      Xiaowu Zhang authored
      See merge request !1628
      6cbb159d
    • Xiaowu Zhang's avatar
      e1360ac0
    • Romain Courteaud's avatar
      erp5_web: force redirection on website using a service worker · 7a7b4a45
      Romain Courteaud authored
      Delete the content of the cache storage (used by erp5js), unregister the service worker and force the browser to reload.
      7a7b4a45
  3. 13 May, 2022 5 commits
  4. 11 May, 2022 1 commit
  5. 10 May, 2022 2 commits
  6. 09 May, 2022 4 commits
  7. 06 May, 2022 8 commits
  8. 04 May, 2022 15 commits
    • Rafael Monnerat's avatar
      erp5_web_renderjs_ui: Add missing classes at login form · 3ffd3418
      Rafael Monnerat authored
         For facebook and openid buttons.
      3ffd3418
    • Rafael Monnerat's avatar
      erp5_web_renderjs_ui: Fix 'Go Back' link on login_form · 21a9fd4e
      Rafael Monnerat authored
        Like in WebSite_login, came_from is an URI Template so we must expand the URI to handle the {&n.me}
        that can be present on the URL.
      21a9fd4e
    • Arnaud Fontaine's avatar
      py3: XMLExportImport: Port to Python3. · 628ab4b4
      Arnaud Fontaine authored
      628ab4b4
    • Arnaud Fontaine's avatar
      py3: ListBox: Port to Python3. · ec025675
      Arnaud Fontaine authored
      ec025675
    • Arnaud Fontaine's avatar
      py3: BusinessTemplate: Fix reading of BusinessTemplate files. · 719b7c3f
      Arnaud Fontaine authored
      With Python2, properties were all str(). with Python3, we need to distinguish
      binary-like properties from text-like properties.
      
      This should ideally be implemented by checking PropertySheet elementary_type
      (such as `data` for bytes() and `string` or `text` for str()) for each property.
      For now (bootstrap/addERP5Site) though, let's consider all properties in .xml to
      be UTF-8 str() and statically define which is which for non-.xml files.
      719b7c3f
    • Arnaud Fontaine's avatar
      py3: _mysql.string_literal() returns bytes(). · 94739085
      Arnaud Fontaine authored
      And _mysql/mysqldb API (_mysql.connection.query()) converts the query string to
      bytes() (additionally, cursor.execute(QUERY, ARGS) calls query() after
      converting everything to bytes() too).
      94739085
    • Arnaud Fontaine's avatar
    • Arnaud Fontaine's avatar
    • 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
    • Arnaud Fontaine's avatar
      py3: pylint: Fix `six` false positive errors (see pylint/astroid related patches in SlapOS). · a6e1d433
      Arnaud Fontaine authored
      * past.builtins:
        portal_skins/erp5_core/Base_sortObjectListLikeSQL:0:2:Redefining built-in 'cmp' (redefined-builtin)
      * six and six.moves imports:
        + portal_skins/erp5_core/Base_updateListboxSelection:0:2:Redefining built-in 'basestring' (redefined-builtin)
        + portal_skins/erp5_core/ERP5Site_checkDataWithScript:20:2:Redefining built-in 'xrange' (redefined-builtin),
      a6e1d433
    • Arnaud Fontaine's avatar
      py3: PythonScript: func_{code,defaults} (Python2 only) => __{code,defaults}__ (Python2/Python3). · 4115e465
      Arnaud Fontaine authored
      Use the latter form that works on both. On non-PythonScript code, this is of
      course not an issue but Python2 PythonScript does not have a __code__ properties
      and requires a patch on Shared.DC.Scripts.Signature (applied by SlapOS recipe)
      so that FuncCode() object is set to not only func_code but also __code__.
      4115e465
    • Arnaud Fontaine's avatar
    • Arnaud Fontaine's avatar
      py3: Disable Python2-only ZopePatch. · 2a3e24e0
      Arnaud Fontaine authored
      And also disable pylint patch as pylint version with Python3 support is not
      supported yet by ERP5...
      2a3e24e0
    • Arnaud Fontaine's avatar
      py3: Add helper functions to write code for both python2 and python3. · fa66bc52
      Arnaud Fontaine authored
      * Add functions to properly convert/handle bytes/str/unicode (from
        slapos.util) (stricter than six.ensure_{text,str}()).
      * Python3 {keys,values,items}() now returns dict_{keys,values,items} rather than
        real list() so add ensure_list() to create a list() when it is latter modified
        but do nothing on Python2 for performance sake.
      fa66bc52
    • Arnaud Fontaine's avatar
      ae3fe621