Пример #1
0
def vendor_to_longlat(spreadsheet):
  '''Making a dictionary from Tech Beckas spreadsheet'''
  sheet = open(spreadsheet, 'r')
  sheet = sheet.readlines()
  vendor_longlat = {}

  for item in range(len(sheet)):
    sheet[item]=sheet[item].split(',')
  for item in sheet:
    try:
      item[2] = item[2].strip('\n')
      s = Spot(id = item[0], latitude = item[1], longitude = item[2], location_image = "", spot_id =item[0], general_area ="")
      s.put()
    except:
      pass
Пример #2
0
def home():
  query = Occupant.query()
  tmp_vendors = convertVendors(query)
  vendors = {'vendors':tmp_vendors}

  #query = Spot.query()
  #query_spots = convertSpots(query)
  tmp_spots = []

  for v in tmp_vendors:
    spot = Spot.get_by_id(v['spot_id'])
    if spot != None:
      tmp = convertOneSpot(spot,v)
      tmp_spots.append(tmp)

  spots = {'spots':tmp_spots}

  header = template('header', home="active", vendor="", edit="", about="")
  content = template('buyer', vendors, spots)
  footer = template('footer',"")
  deleted = """
  <script>
    $(window).load(function() {
    alert("The spot entered and it's information has been deleted. \\n\\nThank you!");
    });
  </script>"""
  confirmation = """
  <script>
    $(window).load(function() {
    alert("Your reservation is complete! Please note that official reservations must be made through the Student Center and not through antTrails. Also, please note that the spots reset at 12am everyday. \\n\\nThank you!");
    });
  </script>
  """

  if request.get_cookie("submittedForm") == "yes":
    response.set_cookie("submittedForm", "no")
    content = template('buyer', vendors, spots)
    return header + content + footer + confirmation
  elif request.get_cookie("deleted") == "yes":  
    response.set_cookie("deleted", "no")
    content = template('buyer', vendors, spots)
    return header + content + footer + deleted
  else:
    return header + content + footer 
Пример #3
0
def isValidSpot(s):

  spot = Spot.get_by_id(s)
  return spot != None