Exemplo n.º 1
0
    def post(self):
        logging.info('GetPostHandler...')

        request = simplejson.loads(self.request.body)
        talky_uid = int(request['talky_uid'])
        user = TalkyUser.get_by_id(talky_uid)
        if user == None:
            logging.info('user is None')

        logging.info(user.spot.name)

        if user.spot == None:
            logging.info('user.spot is None')

        query = UserPost.all()
        query.filter('spotName = ', user.spot.name)
        posts = query.fetch(limit = 10)

        response = {
            'success':True,
            'posts':[]
        }

        for post in posts:
            postData = {
                'owner':post.owner.fb_uid,
                'id':post.key().id(),
                'date_time':serializeDateTime(post.dateTime),
                'content':post.content,
            }
            response['posts'].append(postData)
        self.response.out.write(simplejson.dumps(response))
Exemplo n.º 2
0
    def get(self):
        spotName = unicode(self.request.get('spot-name'))

        query = UserPost.all()
        query.filter('spotName = ', spotName)

        results = query.fetch(limit=1000)
        for result in results:
            result.delete()

        self.response.out.write('Done')