def liquor_types(self, environ, start_response): content_type = 'text/html' text = """ <!DOCTYPE HTML> <html> <head> <title>Liquor Types List</title> <style type='text/css'> h1 {text-decoration:underline; text-align:center; color:red;} body { font-size:14px; } </style> </head> <body> <h1>List of Liquor Types</h1> <ul> <li><a href='/'>Home</a></li> <li><a href='/recipes'>List Recipes</a></li> <li><a href='/inventory'>List Inventory</a></li> <li><a href='/liquor_types'>List Liquor Types</a></li> </ul> <hr /> <ul> """ bottle_types = list(db.get_all_bottle_types()) for (m, l, t) in bottle_types: text += "\t<li>" + t + "</li>\n" text += '</ul>' text += '</body></html>' data = text start_response('200 OK', list(html_headers)) return [data]
def inventory(): loader = jinja2.FileSystemLoader('../drinkz/templates') env = jinja2.Environment(loader=loader) filename = "jinja_inventory.html" inventoryList = [] for liquor_typ in db.get_all_bottle_types(): inventoryList.append(list([str(liquor_typ[0]), str(liquor_typ[1]), str(db.get_liquor_amount(liquor_typ[0], liquor_typ[1])) + " ml"])) vars = dict(title = "Inventory", title2 = "Your Inventory", addtitle = "Add To Your Inventory", form = """ <form action='recv_inventory_add'> Liquor to add? (Format: Johnnie Walker, black label, 500 ml)<br><input type='text' name='liquor' size'20'> <input type='submit'> </form> """, names=inventoryList, bodyFormat = bodyText) template = env.get_template(filename) result = template.render(vars).encode('ascii','ignore') return result
def liquortypes(): loader = jinja2.FileSystemLoader('../drinkz/templates') env = jinja2.Environment(loader=loader) filename = "jinja_bottle_types.html" liquortypesList = [] for liquor_typ in db.get_all_bottle_types(): liquortypesList.append(list([str(liquor_typ[0]), str(liquor_typ[1])])) vars = dict(title = "Liquor Types", title2 = "Your Liquor Types", addtitle="Add Bottle Type", form = """ <form action='recv_bottle_add'> Bottle Type to add? (Format: Johnnie Walker, black label, blended scotch whiskey)<br><input type='text' name='bottle' size'20'> <input type='submit'> </form> </body></html>""", names=liquortypesList, bodyFormat = bodyText) template = env.get_template(filename) result = template.render(vars).encode('ascii','ignore') return result
def rpc_GetLiquorTypes(self): return list(db.get_all_bottle_types());