def post(self):
        self.response.out.write(self.request)
        lat = self.request.get("lat")
        long = self.request.get("long")
        email = self.request.get("email")

        location = Location(parent=Location.location_key(email))
        self.response.out.write("location : %s" % location)
        location.lat = lat
        location.long = long
        location.email = email
        location.put()
        self.redirect("/LocSubmit?" + urllib.urlencode({"email": email}))
    def get(self):
        email = self.request.get("email")
        limit = self.request.get("limit")
        query = ""
        if len(limit) > 0 and int(limit) > 0:
            query = "select * from Location where ANCESTOR IS :1 order by datetime desc limit %s" % limit
        else:
            query = "select * from Location where ANCESTOR IS :1 order by datetime desc "

        locations = db.GqlQuery(query, Location.location_key(email))

        retObject = []
        for location in locations:
            record = {}
            record["email"] = location.email
            record["lat"] = location.lat
            record["long"] = location.long
            record["DateTime"] = str(location.datetime)
            retObject.append(record)
        self.response.headers["Content-Type"] = "application/json"
        self.response.out.write(json.dumps(retObject))
    def get(self):
        email = self.request.get('email')
        locations = db.GqlQuery(
            "select * from Location where ANCESTOR IS :1 order by datetime desc limit 1 ",
            Location.location_key(email))

        for location in locations:
            self.response.out.write(
                'Existing value for : <b>email: %s, lat: %s, long: %s, timestamp: %s</b>'
                % (location.email, location.lat, location.long,
                   location.datetime))

        self.response.out.write("""<html>
        <body>
            <form action="/Location_Post" method="post">
            <div><textarea name="lat" rows="1" cols="20"></textarea>
            <textarea name="long" rows="1" cols="20"></textarea></div>
            <textarea name="email" rows="1" cols="20"></textarea>   
            <div><input type="submit" value="set lat/long"></div>
            </form>
            
            To get data in json: go to <a href="/Location.json">Location.json</a> and pass email as a parameter. eg /location.json?email=rohan.shah 
            </body></html>""")