예제 #1
0
    def get(self):
        """Return top content near a location."""

        args = {
            "access_token":     self.get_argument("access_token"),
            "lng":              self.get_argument("lng"),
            "lat":              self.get_argument("lat"),
            }
        user_id = yield sundowner.auth.validate(args["access_token"])
        validate.ContentHandlerValidator().validate_get(args)

        # get all nearby content
        result = yield ContentModel.get_nearby(
            args["lng"], args["lat"], user_id)

        # write activity
        self.settings["activity_pub"].write_user_view_content(
            user_id, args["lng"], args["lat"])

        self.complete(data=result)
 def query_content():
     result = yield ContentModel.get_nearby(
         self.QUERY_LNG, self.QUERY_LAT, user_id)
     raise tornado.gen.Return(result)