def add_to_check_in_db(self, user_id, check_in): "retreives the stored information and places it in the database" if check_in.get('modality') == 'tube': u = user_id o = check_in.get('origin') d = check_in.get('destination') t = check_in.get('time_stamp') l = get_lines(self, check_in.get('lines')) rd = check_in.get('delay') rc = check_in.get('crowd') rh = check_in.get('happy') longi = check_in.get('longitude') lat = check_in.get('latitude') t = datetime.strptime(t, '%Y-%m-%d %H:%M:%S') # This will need to be gotten rid of, but at the moment lines aren't sent so for other functionality this will have to do # l = find_line(self, o) + find_line(self, d) key = check_in_db_key('check_in_database') entry = check_in_db( parent = key, user = u, origin = o, destination = d, line = l, time_sent = t, rating_delay = rd, rating_crowded = rc, rating_happiness = rh, longitude = longi, latitude = lat ) entry.put()
def get(self): "Gets datum from an encoded url - will not be used, ideally" u=self.request.GET.get('user') o=self.request.GET.get('origin') d=self.request.GET.get('destination') t=self.request.GET.get('time') rd=self.request.GET.get('delay') rc=self.request.GET.get('crowd') rh=self.request.GET.get('happy') longi=self.request.GET.get('long') lat=self.request.GET.get('lat') c=self.request.GET.get('comment') # /posted/here?&user=adam&origin=Euston&destination=Liverpool Street&time=2011-07-27 15:40:00&delay=300&crowd=100&happy=500&lat=34&long=-5 l = self.find_line(o) + self.find_line(d) database=check_in_db_key('check_in_database') check_in = check_in_db(parent=database, user=u, origin=o, destination=d, line=l, time_sent=t, rating_delay=rd, rating_crowded=rc, rating_happiness=rh, longitude=longi, latitude=lat, comment=c) check_in.put()