def get(self, blip_key=None): blip = Blip.get(blip_key) if blip is None: return self.error(404) login_user = self.get_current_user() if blip.meeting and not blip.meeting.has_member(login_user): return self.error(401) user = blip.user _, profile = Profile.get_or_create_from_user(user) is_self = user == login_user has_followed = False if not is_self: has_followed = Follow.gql('WHERE from_user = :1 AND to_user = :2', login_user, user).get() is not None followers = Follow.who_subscribe_you(user) follower_profiles = [] for f in followers: c, p = Profile.get_or_create_from_user(f.from_user) follower_profiles.append(p) followees = Follow.your_subscribers(user) followee_profiles = [] for f in followees: c, p = Profile.get_or_create_from_user(f.to_user) followee_profiles.append(p) return self.render('blip_item.html', locals())
def get(self, user_name=None): login_user = self.get_current_user() if user_name is None: return self.redirect('/signin') profile = Profile.gql('WHERE nickname=:1', user_name).get() if not profile or not profile.is_active: return self.error(404) user = profile.get_user() is_self = user == login_user has_followed = False if not is_self: has_followed = Follow.gql('WHERE from_user = :1 AND to_user = :2', login_user, user).get() is not None followers = Follow.who_subscribe_you(user) follower_profiles = [] for f in followers: c, p = Profile.get_or_create_from_user(f.from_user) follower_profiles.append(p) followees = Follow.your_subscribers(user) followee_profiles = [] for f in followees: c, p = Profile.get_or_create_from_user(f.to_user) followee_profiles.append(p) try: page = int(self.request.get('page', '1')) except ValueError: page = 1 has_followed = Follow.gql('WHERE from_user = :1 AND to_user =:2', login_user, user).get() pagesize = settings.BLIP_PAGE_SIZE paginator = SimplePaginator(Blip.qs_for_author(user), page, pagesize) blips = each_profiles(paginator.object_list) return self.render('user_page.html', locals())
def get(self, user_name=None): login_user = self.get_current_user() target_profile = ProfileByNickView(user_name).get() if target_profile is None: return self.error(404) target_user = target_profile.get_user() follow = Follow.gql("WHERE from_user=:1 AND to_user=:2", login_user, target_user).get() if follow: follow.delete() follow.update_profile() BlipLink.delete_for_author(login_user, target_user) return self.redirect('/home')