Esempio n. 1
0
    def add_liquor_type_recv(self, environ, start_response):
        formdata = environ['QUERY_STRING']
        results = urlparse.parse_qs(formdata)
        mfg = results['mfg'][0]
        liquor = results['liquor'][0]
        typ = results['typ'][0]
        db.add_bottle_type(mfg, liquor, typ)
        db.save_db('bin/sample_database')
        taste_of_success = db._check_bottle_type_exists(mfg, liquor)
        if taste_of_success == True:
            data = generate_html.generate_liquor_types_html()

        else:
            content_type = 'text/html'
            data = """  <html>
    <head>
    <title>Failure to Add Liquor!</title>
        <style type ="text/css">
        h1{color:red;}
    </style>
    </head>
    <body>"""
            data += """Failed to add Liquor type, please try again!"""
            data += generate_html.generate_menu()
            data += """
</body>
</html>
"""     
        start_response('200 OK', list(html_headers))
        return [data]
Esempio n. 2
0
    def add_to_inventory_recv(self, environ, start_response):
        formdata = environ['QUERY_STRING']
        results = urlparse.parse_qs(formdata)

        mfg = results['mfg'][0]
        liquor = results['liquor'][0]
        amount = results['amount'][0]
        myBool = db.check_inventory(mfg,liquor)
        if myBool == True:
            intial_amt = db.get_liquor_amount(mfg,liquor)
        else:
            intial_amt = 0
        db.add_to_inventory(mfg, liquor, amount)
        db.save_db('bin/sample_database')
        taste_of_success = db.check_inventory(mfg, liquor)
        amt_success = db.get_liquor_amount(mfg,liquor)
        if taste_of_success == True and amt_success > intial_amt:
            data = generate_html.generate_liquor_types_html()

        else:
            content_type = 'text/html'
            data = """  <html>
    <head>
    <title>Failure to Add Liquor!</title>
        <style type ="text/css">
        h1{color:red;}
    </style>
    </head>
    <body>"""
            data += """Failed to add Liquor type, please try again!"""
            data += generate_html.generate_menu()
            data += """
</body>
</html>
"""     
        start_response('200 OK', list(html_headers))
        return [data]
Esempio n. 3
0
 def liquorTypes(self, environ, start_response):
     data = generate_html.generate_liquor_types_html()
     start_response('200 OK', list(html_headers))
     return [data]