[web2py] Re: update 2 session value using module only first session value work

2016-01-15 Thread Anthony
Sorry, this isn't very clear. It might help if you attach a minimal app that reproduces the problem. Also, it is not clear why session.sale_order_net is a dictionary with a single key of 0. It's also not advisable to use an integer as a dictionary key unless you are doing so for a special purpo

[web2py] Re: update 2 session value using module only first session value work

2016-01-15 Thread 黄祥
it's just conditional logic is not applied when define the session. e.g. *controllers* if session.sale_order_net: session.sale_order_net = session.sale_order_net else: session.sale_order_net = {} session.sale_order_net[0] = dict(discount = 0, delivery_fee = 0, packing_fee = 0, stamp_fee = 0, paid

[web2py] Re: update 2 session value using module only first session value work

2016-01-15 Thread 黄祥
the previous is not work, it's work first because it still store the previous session, after clean session, cache and error it's not work. something strange in here. e.g. *controllers* session.sale_order_net = session.sale_order_net or {} #session.sale_order_net[0] = dict(discount = 0, delivery_

[web2py] Re: update 2 session value using module only first session value work

2016-01-13 Thread 黄祥
thank you so much for detail explaination, anthony. i found another way around that work fine, don't know is this best practice or not because it hard code to reserve the place in session variable. like describe in the previous post, i want this module function can be used by another functions

[web2py] Re: update 2 session value using module only first session value work

2016-01-13 Thread Anthony
Presumably you are calling this function as follows: callback_0(session.order, session.sale_order_net) The problem is you later have: session_order_net = dict(...) At that point, you are not modifying the session.sale_order_net object but simply assigning a new object to the local variable