def render(self, context):
        request = context['request']
        category = self.category.resolve(context)
        try:
            categories = map(int, category.split(','))
        except:
            context[self.var_name] = []
            return ''

        allowed_objects = get_allowed_objects(
            request.user, ArticleCategory, 'reader')
        categories = [ c for c in categories if c in allowed_objects]
        if categories:
            categories = ArticleCategory.objects.filter(pk__in=categories)
            mao = get_allowed_objects(
                request.user, ArticleCategory, 'reader')

            stories = ArticleStory.objects.select_related().filter(
                categories__in=categories).distinct().order_by('-time_updated')[:int(self.limit)]
            for story in stories:
                story.current_categories = story.categories.all()
                story.current_category = story.current_categories[0]
                story.url = reverse('view_story', args=[story.current_category.pk, story.pk, story.slug])
                intersect = set(mao).intersection( set([category.pk for category in story.current_categories]))
                if intersect:
                    story.edit__url = reverse('edit_story', args=[story.pk])
        else:
            stories = []
        context[self.var_name] = stories
        return ''
dataset/ETHPy150Open zorna/zorna/zorna/articles/templatetags/articles_tags.py/get_category_stories_node.render/original