Пример #1
0
def add_restaurant():
    name = raw_input("Enter Restaurant Name: ")
    cuisine = raw_input("Enter Restaurant type: ")
    cost = raw_input("Enter Restaurant cost (out of 5): ")
    fave = raw_input("Enter star rating (out of 5): ")
    dist = raw_input("Enter distance (minutes' walk): ")
    restaurants[name] = shared.Restaurant(name, cuisine, cost, fave, dist)
def add_new_restaurant():
    name = request.forms.get('name')
    cuisine = request.forms.get('type')
    cost = request.forms.get('cost')
    fave = request.forms.get('fave')
    dist = request.forms.get('dist')
    restaurants[name] = shared.Restaurant(name, cuisine, cost, fave, dist)
    shared.save_changes(filename, restaurants)
    return generate_response(name)
 def POST(self):
     # Add some code in here to add the input to the internal restaurants data
     # Then save it out (call the function to save the changes)
     # Then send the HTML for the new restaurant back, like for TripDevisor above
     input_data = web.input()
     name = input_data.name
     type = input_data.type
     cost = input_data.cost
     fave = input_data.fave
     dist = input_data.dist
     restaurants[name] = shared.Restaurant(name, type, cost, fave, dist)
     shared.save_changes(filename, restaurants)
     return generate_response(name)