Tryton - Issues



Title TypeError: must use keyword argument for key function in account/ using python3
Priority bug Status chatting
Superseder Nosy List ced, risto3
Type crash Components account
Assigned To Keywords Python3, easy

Created on 2017-07-24.07:34:55 by risto3, last changed by pokoli.

msg34901 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2017-07-30.14:09:02
Off-topic: we are waiting your contribution at issue2178
msg34900 (view) Author: [hidden] (risto3) Date: 2017-07-30.13:38:41
please provide then a means to login to rietveld/codereview without g$$gle services. 

(see and rms'

Has the tryton project considered any alternatives preventing this vendor lock-in such as kallithea or perhaps reviewboard?
msg34899 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2017-07-30.10:58:25
So please do not send patches if you do not follow the procedure.
msg34898 (view) Author: [hidden] (risto3) Date: 2017-07-30.08:50:12
apparently rietveld still requires a g$$gle account. Sorry, don't do that.
Any reason why the user/pw from here (roundup) cannot be used?
msg34888 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2017-07-29.23:34:13
Please to submit patch follow:
msg34737 (view) Author: [hidden] (risto3) Date: 2017-07-24.13:22:08
May not be strictly what is intended, but using:

@@ -169,8 +169,7 @@
             values = values.copy()
             if 'periods' in values:
                 operator = ['delete', 'remove', 'create', 'write', 'add']
-                values['periods'].sort(lambda x, y:
-                    cmp(operator.index(x[0]), operator.index(y[0])))
+                values['periods'].sort(key=lambda x: operator.index(x[0]))
             args.extend((fiscalyears, values))
         super(FiscalYear, cls).write(*args)

let's me proceed, for now.
msg34728 (view) Author: [hidden] (risto3) Date: 2017-07-24.07:34:55
Encountered issue with python3, there yet seems to be a couple of cases using .sort() with 'cmp' instead of 'key'... namely:
Traceback (most recent call last):
  File "/trytond/", line 47, in dispatch_request
    return endpoint(request, **request.view_args)
  File "/trytond/protocols/", line 41, in rpc
    request, database_name, *request.rpc_params)
  File "/trytond/", line 39, in auth_required
    return wrapped(*args, **kwargs)
  File "/trytond/protocols/", line 105, in wrapper
    return func(request, pool, *args, **kwargs)
  File "/trytond/protocols/", line 165, in _dispatch
    result = rpc.result(meth(*c_args, **c_kwargs))
  File "/trytond/modules/account/", line 172, in write
    values['periods'].sort(lambda x, y:
TypeError: must use keyword argument for key function

this is the code snippet:
    def write(cls, *args):
        actions = iter(args)
        args = []
        for fiscalyears, values in zip(actions, actions):
            if values.get('post_move_sequence'):
                for fiscalyear in fiscalyears:
                    if (fiscalyear.post_move_sequence
                            and !=
                        cls.raise_user_error('change_post_move_sequence', (
            values = values.copy()
            if 'periods' in values:
                operator = ['delete', 'remove', 'create', 'write', 'add']
                values['periods'].sort(lambda x, y:
                    cmp(operator.index(x[0]), operator.index(y[0])))
            args.extend((fiscalyears, values))
        super(FiscalYear, cls).write(*args)

(I believe another case is stock_supply/
Date User Action Args
2017-08-18 14:57:36pokolisetkeyword: + easy
2017-07-30 14:09:02cedsetmessages: + msg34901
2017-07-30 13:38:41risto3setmessages: + msg34900
2017-07-30 10:58:26cedsetmessages: + msg34899
2017-07-30 08:50:13risto3setmessages: + msg34898
2017-07-29 23:34:13cedsetnosy: + ced
messages: + msg34888
2017-07-24 13:22:08risto3setstatus: unread -> chatting
messages: + msg34737
2017-07-24 09:28:10cedsetpriority: wish -> bug
type: crash
2017-07-24 07:34:55risto3create

Showing 10 items. Show all history (warning: this could be VERY long)