def get(self): user = users.get_current_user() tuser = TUser.get_or_insert(user.user_id(), user_id=user.user_id()) client = OAuthClient('twitter',self) if tuser.access_token is None: if client.get_cookie(): logging.debug("registered user finished oauth procedure") credentials = client.get('/account/verify_credentials') tuser.access_token = OAuthAccessToken.get_by_key_name(client.get_cookie()) tuser.screen_name = credentials['screen_name'] tuser.profile_image_url = credentials['profile_image_url'] tuser.name = credentials['name'] tuser.put() view = 'just_logged.html' template_values = { 'username':user.nickname(), 'email':user.email() } else: view = 'not_logged.html' template_values = { 'username': user.nickname(), 'email': user.email() } else: template_values = { 'username': user.nickname(), 'email': user.email() } view = 'index.html' path = os.path.join(os.path.dirname(__file__) + '/templates/' + view ) self.response.out.write(template.render(path, template_values))
def get(self): tusers = TUser.all().fetch(10) for u in tusers: u.fetch_twits()