def rpc_add_liquor(self, mfg, liquor, typ): n = False result = db._check_bottle_type_exists(mfg, liquor) if result == False: db._bottle_types_db.add((mfg, liquor, typ)) n = True return n
def inventory_Rev(self, environ, start_response): formdata = environ['QUERY_STRING'] results = urlparse.parse_qs(formdata) mfg = results['mfg'][0] liq = results['liquor'][0] amt = results['amount'][0] #print amt data = "" bottleTypExists = db._check_bottle_type_exists(mfg, liq) if bottleTypExists == True: db.add_to_inventory(mfg, liq, amt) data += "Added Liquor to Inventory" else: data = "Could not add bottle to inventory, Liquor bottle type could not be found" data += "<p><a href='/'>Index</a></p>" start_response('200 OK', list(html_headers)) return [data]
#! /usr/bin/env python import os from drinkz import db, recipes db._reset_db() db.load_db('savedtestdb') if db._check_bottle_type_exists('Johnnie Walker', 'Black Label'): present = 'Black Label' if db._check_bottle_type_exists('Anheuser-Busch', 'Bud Light'): presen = 'Bud Light' r = recipes.Recipe() d = r.need_ingredients() for k in d: print d[k] i = 0 value = db.get_recipe('scotch on the rocks')
def rpc_lt(self, mfg, liquor, typ): db.add_bottle_type(mfg, liquor, typ) print db._check_bottle_type_exists("Johnnie Walker", "Black Label") return mfg + " " + liquor + " " + typ