Beispiel #1
0
    def rpc_get_recipe_names(self):
        all_recipes = db.get_all_recipes()
        recipe_names = []
        for rec in all_recipes:
            recipe_names.append(rec.name)

        return recipe_names
Beispiel #2
0
    def recipes(self, environ, start_response):
        start_response('200 OK', list(html_headers))

        title = "recipes"
        recipe_list = [r for r in db.get_all_recipes()]
        mixable_recipes = [m for m in db.get_mixable_recipes()]

        template = env.get_template("recipes.html")
        return str(template.render(locals()))
Beispiel #3
0
    def recipes(self, environ, start_response):
        data = """\

<head><title>Recipes</title>
<style type="text/css">
h1 {color:red;}
</style>
</head>
<body>
<h1>Recipes</h1>

<p>You can add the ratings through the code or through a form on the website.
The overall rating is the average across all ratings. The only ones that count are 0-5.</p>
        
Visit:
<a href='content'>a file</a>,
<a href='error'>an error</a>,
<a href='helmet'>an image</a>,
<a href='somethingelse'>something else</a>, or
<a href='form'>a form...</a>
<a href='inventory'>Inventory</a>
<a href='recipes'>Recipes</a>
<a href='index'>Index</a>
<p>
<img src='/helmet'>
</body>
"""

        for r in db.get_all_recipes():
            data += "<li>"
            data += r.name
            if r.need_ingredients() == []:
                data += ", Have all ingredients."
            else:
                data += ", Need more ingredients."

            data += " Rating: " + str(r.trueRating)

            data += "</li>\n"
        data += "</ul>"

        start_response("200 OK", list(html_headers))
        return [data]
Beispiel #4
0
# recipes.html

fp = open('html/recipes.html', 'w')

print >>fp, header % 'Recipes'
print >>fp, navbar
print >>fp, """
<h2>Recipes</h2>
<table>
  <tr>
    <th>Recipe Name</th>
    <th>Have Ingredients</th>
  </tr>
"""

for recipe in db.get_all_recipes():
    if recipe.need_ingredients():
        have_ingr = 'No'
        style = ' style="color:gray"'
    else:
        have_ingr = 'Yes'
        style = ''

    print >>fp, """  <tr%s>
    <td>%s</td>
    <td>%s</td>
  </tr>
""" % (style, recipe.name, have_ingr)

print >>fp, "</table>"
print >>fp, footer
Beispiel #5
0

#Index.html

fp = open('html/index.html', 'w')
links = "CSE491 Draankz\n" + liquor_types_html + inventory_html + recipes_html
print >> fp, links

fp.close()


#Recipers.html


fp = open('html/recipes.html', w)
display_recipes = db.get_all_recipes()
recipe_str = "Recipes\n<ol>"

for r in display_recipes:
  if(r.need_ingredients() == []):
    response = "Have all the ingredients"
    
  else:
    response = "Missing some ingredients"
    
  recipe_str += "<li>" + r.name + ": " + response + "</li>\n"
  
recipe_str += "</ol>"
links = index_html + liquor_types_html + inventory_html
recipe_str += links
print >> fp, recipe_str
Beispiel #6
0

fp.close()


fp = open('html/recipes.html', 'w')

print >>fp, """
<p><a href='index.html'>Index!</a></p>
<p><a href='recipes.html'>Recipes!</a></p>
<p><a href='inventory.html'>Inventory!</a></p>
<p><a href='liquor_types.html'>Liquor types!</a></p>
<h1>Recipes</h1>
<ul>
"""
for receipes in db.get_all_recipes():
  print >>fp, "<li>"
  print >>fp, receipes.name
  if receipes.need_ingredients() == []:
    print >>fp, ", Have all ingredients."
  else:
    print >>fp, ", Need extra ingredients."

  print >>fp, "</li>"
print >>fp, "</ul>"


fp.close()


fp = open('html/inventory.html', 'w')
Beispiel #7
0
fp = open('html/index.html', 'w')

print >>fp, addr

fp.close()







#for recipe page
fp = open('html/recipes.html', 'w')

lack = db.get_all_recipes()
recipes = "<ol>"
for r in lack:
	if(r.need_ingredients() == []):
		lack = "Yes"
	else:
		lack = "No"
	recipes += "<li>" + r.name + ": " + lack + "</li>\n"

recipes = recipes + "</ol>"+ addr
print >> fp, recipes

fp.close()

# for inventory page
fp = open('html/inventory.html', 'w')
Beispiel #8
0
<p><a href='inventory.html'>Inventory</a></p>
<p><a href='liquor_types.html'>Liquor Types</a></p>
"""
fp.close()







#PAGE RECIPIES
fp = open('html/recipes.html', 'w')

print >>fp, "<b>Recipes</b><p></p>"
allrecipes = db.get_all_recipes()
sendtopage = "<ol>"
for recipe in allrecipes:
	if(recipe.need_ingredients() == []):
		lacking = "Yes, needs more!"
	else:
		lacking = "No, drink now!"
	sendtopage += "<li>" + recipe.recipename + "Have all the Ingridients? " + lacking + "</li>\n"

sendtopage = sendtopage + "</ol>"
print >> fp, sendtopage

print >>fp, """

OTHER PAGES:
<p><a href='index.html'>Back to Index</a></p>
<p>
<a href = 'inventory.html'>Inventory</a>
</p>
<p>
<a href = 'liquor_types.html'>Liquor Types</a>
</p>
"""
fp.close()

###############################################################
#Recipes
#Reference: github.com/ctb/cse491-linkz
###############################################################
fp = open('html/recipes.html', 'w')
print >> fp, """<h1> Recipes</h1>"""
x = list(db.get_all_recipes())
for recipe in x:
	print >> fp, "<h2>%s</h2>" % (recipe.getName())
	print >> fp, "<ul>"
	for ing in recipe.getIngredients():
		print >> fp, "<li>%s -- %s</li>" % (ing[0], ing[1])
	print >> fp, "</ul>"

print >> fp, """<p> 
<a href='index.html'>Home</a>
</p>
<p>
<a href = 'inventory.html'>Inventory</a>
</p>
<p>
<a href = 'liquor_types.html'>Liquor Types</a>
Beispiel #10
0
        
db.add_bottle_type('Gray Goose', 'vodka', 'unflavored vodka')
db.add_to_inventory('Gray Goose', 'vodka', '1 liter')

db.add_bottle_type('Rossi', 'extra dry vermouth', 'vermouth')
db.add_to_inventory('Rossi', 'extra dry vermouth', '24 oz')

r = recipes.Recipe('scotch on the rocks', [('blended scotch','4 oz')])
s = recipes.Recipe('vodka martini', [('unflavored vodka', '6 oz'),('vermouth', '1.5 oz')])
t = recipes.Recipe('vomit inducing martini', [('orange juice','6 oz'),('vermouth','1.5 oz')])

db.add_recipe(r)
db.add_recipe(s)
db.add_recipe(t)

RCPs = db.get_all_recipes()


fp = open('html/index.html', 'w')
print >>fp, """<p><a href='inventory.html'>Inventory</a></p>
<p><a href='recipes.html'>Recipes</a></p>
<p><a href='liquor_types.html'>Liquor Types</a></p>
"""

fp.close()

###

fp = open('html/recipes.html', 'w')

print >>fp, """