<s> from __future__ import absolute_import <EOL> from django import template <EOL> from . models import Feed <EOL> class FeedListNode ( template . Node ) : <EOL> def __init__ ( self , varname ) : <EOL> self . varname = varname <EOL> def render ( self , context ) : <EOL> context [ self . varname ] = Feed . objects . filter ( is_defunct = False ) <EOL> return '<STR_LIT>' <EOL> def do_get_feed_list ( parser , token ) : <EOL> """<STR_LIT>""" <EOL> bits = token . contents . split ( ) <EOL> if len ( bits ) != <NUM_LIT:3> : <EOL> raise template . TemplateSyntaxError , "<STR_LIT>" % bits [ <NUM_LIT:0> ] <EOL> if bits [ <NUM_LIT:1> ] != "<STR_LIT>" : <EOL> raise template . TemplateSyntaxError , "<STR_LIT>" % bits [ <NUM_LIT:0> ] <EOL> return FeedListNode ( bits [ <NUM_LIT:2> ] ) <EOL> register = template . Library ( ) <EOL> register . tag ( '<STR_LIT>' , do_get_feed_list ) </s>
