def prepare_context(self, context): full_timeline = g.director.get_timeline( self.user, page=0, limit=100, actor_only=False, ) filtered_timeline = list( islice(filter(perm_check(c.user), full_timeline), 0, 8)) for activity in filtered_timeline: # Get the project for the activity.obj so we can use it in the # template. Expunge first so Ming doesn't try to flush the attr # we create to temporarily store the project. # # The get_activity_object() calls are cheap, pulling from # the session identity map instead of mongo since identical # calls are made by perm_check() above. session(activity).expunge(activity) activity_obj = get_activity_object(activity.obj) activity.obj.project = getattr(activity_obj, 'project', None) context['timeline'] = filtered_timeline context['activity_app'] = self.activity_app return context
def prepare_context(self, context): full_timeline = g.director.get_timeline( self.user, page=0, limit=100, actor_only=True, ) filtered_timeline = list(islice(ifilter(perm_check(c.user), full_timeline), 0, 8)) for activity in filtered_timeline: # Get the project for the activity.obj so we can use it in the # template. Expunge first so Ming doesn't try to flush the attr # we create to temporarily store the project. # # The get_activity_object() calls are cheap, pulling from # the session identity map instead of mongo since identical # calls are made by perm_check() above. session(activity).expunge(activity) activity_obj = get_activity_object(activity.obj) activity.obj.project = getattr(activity_obj, 'project', None) context.update({ 'follow_toggle': W.follow_toggle, 'following': g.director.is_connected(c.user, self.user), 'timeline': filtered_timeline, 'activity_app': self.activity_app, }) g.register_js('activity_js/follow.js') return context
def prepare_context(self, context): full_timeline = g.director.get_timeline( self.user, page=0, limit=100, actor_only=True, ) filtered_timeline = list( islice(filter(perm_check(c.user), full_timeline), 0, 8)) for activity in filtered_timeline: # Get the project for the activity.obj so we can use it in the # template. Expunge first so Ming doesn't try to flush the attr # we create to temporarily store the project. # # The get_activity_object() calls are cheap, pulling from # the session identity map instead of mongo since identical # calls are made by perm_check() above. session(activity).expunge(activity) activity_obj = get_activity_object(activity.obj) activity.obj.project = getattr(activity_obj, 'project', None) context.update({ 'follow_toggle': W.follow_toggle, 'following': g.director.is_connected(c.user, self.user), 'timeline': filtered_timeline, 'activity_app': self.activity_app, }) g.register_js('activity_js/follow.js') return context
def prepare_context(self, context): full_timeline = g.director.get_timeline( self.user, page=0, limit=100, actor_only=False, ) filtered_timeline = list(islice(ifilter(perm_check(c.user), full_timeline), 0, 8)) for activity in filtered_timeline: # Get the project for the activity.obj so we can use it in the # template. Expunge first so Ming doesn't try to flush the attr # we create to temporarily store the project. # # The get_activity_object() calls are cheap, pulling from # the session identity map instead of mongo since identical # calls are made by perm_check() above. session(activity).expunge(activity) activity_obj = get_activity_object(activity.obj) activity.obj.project = getattr(activity_obj, 'project', None) context['timeline'] = filtered_timeline context['activity_app'] = self.activity_app return context