def get(self):
        self.response.headers['Content-Type'] = 'text/html'
        AccountFunction.getUser(self)
        template_value = self.get_template_value(self)

        template = JINJA_ENVIRONMENT.get_template('home.html')
        self.response.write(template.render(template_value))
Exemplo n.º 2
0
 def get_tempate_values(self,req):
     user = AccountFunction.getUser(req)
     logging.info(user['user'])
     template_value = {
         'user': user,
         'following': len(user['user'].following),
         'follow': len(user['user'].follows),
     }
     return template_value
    def get_template_value(self, req):
        user = AccountFunction.getUser(req)

        if user['user'] and user['user'].user_name:
            req.redirect('/profile')

        template_value = {
            'user': user
        }
        
        return template_value
    def post(self):
        self.response.headers['Content-Type'] = 'text/html'
        template_value = self.get_template_value(self)
        # logging.info(self.request.get("username"))

        AccountFunction.save_username(self.request.get("username"))
        user = AccountFunction.getUser(self)
        if user['user'] and user['user'].user_name:
            self.redirect('/profile')
        template = JINJA_ENVIRONMENT.get_template('home.html')
        self.response.write(template.render(template_value))
    def template_value(self, req):
        user = AccountFunction.getUser(req)
        tweet_data = AccountFunction.get_tweets_for_current_user()
        # logging.info(tweet_data)
        template_value = {
            'user': user,
            'following': len(user['user'].following),
            'follow': len(user['user'].follows),
            'tweet_data': tweet_data,
            'upload_url': blobstore.create_upload_url('/profile'),
            'images': images,
            'AccountFunction': AccountFunction,
        }

        # logging.info(user)
        return template_value
    def template_value(self, req):
        user = AccountFunction.getUser(req)
        params = req.request.params

        if params:
            params['user']

        template_value = {
            'user': user,
            'username':params['user'],
            'status':AccountFunction.get_following_flag(req),
            'tweets':AccountFunction.get_tweets_by_username(params['user']),
            'profile_info':AccountFunction.get_user_by_ueraname(params['user']),
            'followers':len(AccountFunction.get_user_by_ueraname(params['user']).follows),
            'following':len(AccountFunction.get_user_by_ueraname(params['user']).following),
            'images': images,
            'AccountFunction': AccountFunction,
        }

        return template_value