Ejemplo n.º 1
0
 def get(self):
   name = self.request.get("name",False)
   city = self.request.get("city",False)
   if name:
     # adding bookmark if it is not already added
     bookmarks = self.get_bookmarks()
     if bookmarks.has_key(name):
       # assuming all wineries name are unique
       pass # already there
     else:
       # ading it as bookmark
       object = WS.get_by_name(name)
       if object == False:
         logging.error("WARNING: no such winery name '%s', city: '%s'" % (name, city))
       else:
         # yes winery with 'name' exists in db, adding it
         # check for city
         if object[0] == city:
           bookmarks[name] = object # object = (city,state) tuple
           # also we need to save bookmarks
           self.set_bookmarks(bookmarks)
   self.response.out.write("ok") # success