def newRestaurant():
  if request.method == 'POST':
    restaurant_dao.addRestaurant(request.form['name'])
    flash("New restaurant created!")
    return redirect(url_for('restaurantMenus'))
  else:
    return render_template('new-restaurant.html')
  def do_POST(self):
    try:
      ctype, pdict = cgi.parse_header(self.headers.getheader('content-type'))
      self.send_response(301)
      self.send_header('Location','/restaurants')
      self.end_headers()
      if ctype == 'multipart/form-data':
        fields = cgi.parse_multipart(self.rfile, pdict)

      if self.path.endswith("/restaurants/new"):
        name = fields.get('name')[0]
        restaurant_dao.addRestaurant(name)
        return
      elif self.path.endswith("/edit"):
        id = self.path.split("/")[2]
        name = fields.get('name')[0]
        restaurant_dao.updateRestaurant(id, name)
        return
      elif self.path.endswith("/delete"):
        id = self.path.split("/")[2]
        restaurant_dao.deleteRestaurant(id)
        return
    except:
        pass