- 04 May, 2022 21 commits
-
-
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.
-
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).
-
Arnaud Fontaine authored
-
Arnaud Fontaine authored
-
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).
-
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),
-
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__.
-
Arnaud Fontaine authored
-
Arnaud Fontaine authored
And also disable pylint patch as pylint version with Python3 support is not supported yet by ERP5...
-
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.
-
Arnaud Fontaine authored
-
Arnaud Fontaine authored
-
Arnaud Fontaine authored
File "product/TimerService/timerserver/TimerServer.py", line 71, in run s.send('GET / HTTP/1.1\r\n\r\n') TypeError: a bytes-like object is required, not 'str'
-
Arnaud Fontaine authored
And Zope4 now mandates it to be a string ({Shared.DC.ZRDB.TM.TM,ITransactionManager}.sortKey()).
-
Arnaud Fontaine authored
-
Arnaud Fontaine authored
This changes the API to implement similar feature in Python3, but this should not be an issue because Interactor are only for non-ERP5 object...
-
Arnaud Fontaine authored
-
Arnaud Fontaine authored
py3: AccessControl users_with_local_roles() returns a dict_keys() instead of a subscriptable object. Submitted upstream: https://github.com/zopefoundation/AccessControl/pull/128
-
Arnaud Fontaine authored
py3: DCWorkflow is python2-only so make ERP5Site creation work on Python3 WITH_LEGACY_WORKFLOW=False. ERP5 Workflow implementation should ideally not depend on DCWorkflow at all so that legacy DCWorkflow can be disabled for Python2 but this would require much more work.
-
Arnaud Fontaine authored
Mainly for maintenance sake and to update the code before porting it to python3.
-
Xiaowu Zhang authored
See merge request nexedi/erp5!1614
-
- 03 May, 2022 7 commits
-
-
Arnaud Fontaine authored
-
Arnaud Fontaine authored
-
Arnaud Fontaine authored
-
Julien Muchembled authored
Seems required for Chameleon 3.2
-
Julien Muchembled authored
See also commit 8c222bd5 ("Switch to class-based completely instead of id-based styling").
-
Julien Muchembled authored
-
Julien Muchembled authored
-
- 02 May, 2022 3 commits
-
-
Xiaowu Zhang authored
See merge request nexedi/erp5!1611
-
Xiaowu Zhang authored
we may get stopped SM in some case, maybe it's because sql is not updated. here is some trackback: ------ 2022-05-02 09:30:17,457 INFO InvoiceTransaction_selectInvoiceMovement, 37: <object object at 0x7f707a6e61f0> started sm ------ 2022-05-02 09:30:17,459 INFO InvoiceTransaction_selectInvoiceMovement, 37: <object object at 0x7f707a6e61f0> started sm ------ 2022-05-02 09:30:17,579 INFO InvoiceTransaction_selectDelivery, 27: <object object at 0x7f707a6e61f0> {<Sale Invoice Transaction at /nexedi/accounting_module/20220502-3DD4B45>: 1} ==> slappart8/var/log/zope-0-event.log <== ***************************** deliver sale invoice transaction ------ 2022-05-02 09:30:21,512 INFO RuleTool Updating simulation for /nexedi/accounting_module/20220502-3DD4B45: {'create_root': 1, 'index_related': 1} ==> slappart5/var/log/zope-0-event.log <== ------ 2022-05-02 09:30:22,892 WARNING SQLDict Exception raised when invoking messages (uid, path, method_id) [(275788776658006010L, ('', 'nexedi', 'accounting_module', '20220502-3DD4B45'), '_localBuild')] Traceback (most recent call last): File "/srv/slapgrid/slappart16/srv/runner/software/cc627918c55102e3f1a6c6a0077f41bb/parts/erp5/product/CMFActivity/Activity/SQLBase.py", line 868, in dequeueMessage transaction.commit() File "/srv/slapgrid/slappart16/srv/runner/software/cc627918c55102e3f1a6c6a0077f41bb/eggs/transaction-1.7.0-py2.7.egg/transaction/_manager.py", line 123, in commit return self.get().commit() File "/srv/slapgrid/slappart16/srv/runner/software/cc627918c55102e3f1a6c6a0077f41bb/eggs/transaction-1.7.0-py2.7.egg/transaction/_transaction.py", line 280, in commit reraise(t, v, tb) File "/srv/slapgrid/slappart16/srv/runner/software/cc627918c55102e3f1a6c6a0077f41bb/eggs/transaction-1.7.0-py2.7.egg/transaction/_transaction.py", line 271, in commit self._commitResources() File "/srv/slapgrid/slappart16/srv/runner/software/cc627918c55102e3f1a6c6a0077f41bb/eggs/Products.TIDStorage-5.5.0-py2.7.egg/Products/TIDStorage/transaction_transaction.py", line 25 1, in _commitResources result = original__commitResources(self, *args, **kw) File "/srv/slapgrid/slappart16/srv/runner/software/cc627918c55102e3f1a6c6a0077f41bb/eggs/transaction-1.7.0-py2.7.egg/transaction/_transaction.py", line 416, in _commitResources reraise(t, v, tb) File "/srv/slapgrid/slappart16/srv/runner/software/cc627918c55102e3f1a6c6a0077f41bb/eggs/transaction-1.7.0-py2.7.egg/transaction/_transaction.py", line 390, in _commitResources rm.commit(self) File "/srv/slapgrid/slappart16/srv/runner/software/cc627918c55102e3f1a6c6a0077f41bb/eggs/ZODB-4.4.5-py2.7.egg/ZODB/Connection.py", line 582, in commit self._commit(transaction) File "/srv/slapgrid/slappart16/srv/runner/software/cc627918c55102e3f1a6c6a0077f41bb/eggs/ZODB-4.4.5-py2.7.egg/ZODB/Connection.py", line 630, in _commit raise ConflictError(object=obj) ConflictError: database conflict error (oid 0x0c78a313, class erp5.portal_type.Sale Invoice Transaction) ------ ******************* /nexedi/accounting_module/20220502-3DD4B45 localbuild restart because of ConflictError 2022-05-02 09:30:23,340 INFO InvoiceTransaction_selectInvoiceMovement, 37: <object object at 0x7f707a6e61f0> stopped sm ------ 2022-05-02 09:30:23,342 INFO InvoiceTransaction_selectInvoiceMovement, 37: <object object at 0x7f707a6e61f0> stopped sm ------ 2022-05-02 09:30:23,381 INFO InvoiceTransaction_selectDelivery, 27: <object object at 0x7f707a6e61f0> {<Sale Invoice Transaction at /nexedi/accounting_module/20220502-3DD4B45>: 1}
-
Jérome Perrin authored
using json in 37b795fb was wrong, because not all arguments can be converted to json (for example DateTime instances) This also enable the format using pprint.pformat for args, instead of a simple str that was done in ActivityTool_getMessageList.
-
- 29 Apr, 2022 6 commits
-
-
Rafael Monnerat authored
See merge request nexedi/erp5!1600
-
Rafael Monnerat authored
-
Rafael Monnerat authored
The portal_skins was choosen to store the images to use proper http cache.
-
Rafael Monnerat authored
It is really not required, so we follow up the same as google oauth.
-
Rafael Monnerat authored
See merge request nexedi/erp5!1607
-
Rafael Monnerat authored
See merge request nexedi/erp5!1608
-
- 28 Apr, 2022 3 commits
-
-
Xiaowu Zhang authored
-
Xiaowu Zhang authored
-
Xiaowu Zhang authored
-