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_order:3:price:2quantity:1
btw, why there is an L on the back of the reference id? when i print the
row.id in the view i got the id wihout L, but when i put it on the session,
i got the extra L
when i debug the program, the result i got the extra L too for my id.
e.g. bonus extra L
Traceback (most recent call last):
File "C:\Users\sugizo\Desktop\web2py\web2py\gluon\restricted.py", line 217,
in restricted
exec ccode in environment
File
"C:\Users\sugizo\Desktop\web2py\web2py\applications\citifone\views\transaction/purchase_cart.html",
line 177, in <module>
KeyError: 2L
*views/transcation/purchase_cart.html*
{{for i, row in enumerate(rows):}}
<div>
<table class="table">
{{if i == items_per_page: break}}
<tr>
<td>
{{=SPAN(row.id) }}
</td>
<td>
{{=SPAN(row.code) }}
</td>
<td>
{{=SPAN(row.name) }}
</td>
<td>
{{=SPAN(session.purchase_order[row.id]['quantity'], _id="item_%s" % row.id)
}}
{{=T('In Order') }}
</td>
<td>
{{=SPAN(A(I(_class = 'icon-plus'), _class = 'btn btn-info',
_title='Add Quantity', target='item_%s' % row.id,
callback=URL('purchase_order_callback', vars=dict(id=row.id, action='add')
) ) ) }}
{{=SPAN(A(I(_class = 'icon-minus'), _class = 'btn btn-warning',
_title='Substract Quantity', target='item_%s' % row.id,
callback=URL('purchase_order_callback', vars=dict(id=row.id,
action='subtract') ) ) ) }}
</td>
</tr>
</table>
</div>
{{pass}}
thanks and best regards,
stifan
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.