found the culprit now :
never thought that the ajax function eval target can be more than one
target form field.
best regards,
stifan
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.goog
how can i get and set the session value that is store as a tuple?
e.g.
*controllers/transaction.py*
def purchase_order_callback():
#from gluon.debug import dbg
#dbg.set_trace()
id = int(request.vars.id)
quantity, price = session.purchase_order.get(id, (0, 0) )
if request.vars.action == 'add':
quant
Ids are Python long integers, so when the repr method is called to display
them in some contexts, the L is appended. That shouldn't be causing your
error, though -- instead, looks like there is no 2 key in purchase_order.
Anthony
On Friday, January 31, 2014 6:15:02 PM UTC-5, 黄祥 wrote:
>
> yeah,
yeah, you are right, your code is work, i found the root cause is on the
*views/transcation/purchase_cart.html*
{{=SPAN(session.purchase_order[row.id]['quantity'], _id="item_%s" % row.id)
}}
{{=T('In Order') }}
when i remove it, and look into response.toolbar() i got my expected session
purchase
I think it will make things a lot easier if you spend some time learning
Python a little better. That will help you to understand the original code
and how to modify it to suit your needs. max() and .get() are standard
Python functions -- you should be able to find lots of places to explain
wha
pardon, could you explain the meaning of this code, please :
1. quantity = max(0, quantity + 1)
2. quantity = session.purchase_order.get(id, 0)
what is the 0 (zero) meaning on code above? the code is taken from web2py
appliances pos online store, yet it work when i took the price from the
datab
Looks like there is no purchase_order with id=3 in the session. You'll have
to do some debugging to figure out where it's going wrong.
On Thursday, January 30, 2014 7:43:48 PM UTC-5, 黄祥 wrote:
>
> thanks anthony, i've tried your hint, but it return a new traceback on
> purchase_cart when i click
thanks anthony, i've tried your hint, but it return a new traceback on
purchase_cart when i click add or subtract:
Traceback (most recent call last):
File "/home/mdipierro/make_web2py/web2py/gluon/restricted.py", line 217, in
restricted
File
"C:/Users/sugizo/Desktop/web2py/2.8.2/application
>
> quantity = session.purchase_order.get(id, 0)
> price = session.purchase_order.get(id, 0)
>
session.purchase_order.get(id, 0) is returning a single object (in this
case a dict), yet you are assigning that same object to both quantity and
price. Instead, you have to access the individ
thanks all for the pointer, yet it still not work as expected.
e.g.
def purchase_order_callback():
id = int(request.vars.id)
quantity = session.purchase_order.get(id, 0)
price = session.purchase_order.get(id, 0)
if request.vars.action == 'add':
quantity = max(0, quantity + 1
For confirmation you can do something like
print session
just before you return your jquery.
On Wednesday, January 29, 2014 7:53:21 PM UTC-5, 黄祥 wrote:
>
> hi,
>
> is it possible to add the session value to an existing session? let say i
> have the session purchase_order that store quantity, us
>
> session.purchase_order[id] = quantity
> session.purchase_order[id] = price
>
Above you are storing just a single value in session.purchase_order[id] --
the second assignment simply overwrites the first assignment. Instead, it
appears you want to store a dict, so replace the above with:
ses
12 matches
Mail list logo