Esempio n. 1
0
    def test_add_item(self):
        with self.config:
            oi = orders.create_new_order(2)
	orders.add_item(oi, 1, 1)
        ret = db.select('OrderedItems', where='order_id='+str(oi))
        ti = ret[0]
        self.assertEquals(ti.item_id, 1)
Esempio n. 2
0
    def POST(self):
        #if (web.config._session.roleid != 4):
        #        raise web.seeother('/')
        pdata = web.input(item=None, order_id=None, action=None)
        if pdata.action == "order":
		add_item(pdata.order_id, pdata.item, 1)
        elif pdata.action == "remove":
                delete_item(pdata.order_id, pdata.item)
        orlist = get_order(pdata.order_id)
        tags = db.select('Categories').list()
        items = menu.get_menu_items()
        page = render.customer_banner(items, pdata.order_id, orlist, tags)
        return render_page(page)