<s> from datetime import date <EOL> from django . contrib . syndication . feeds import Feed <EOL> from django . core . exceptions import ObjectDoesNotExist <EOL> from django . http import Http404 <EOL> from django . template . defaultfilters import escape <EOL> from brubeck . blogs . models import Blog , Entry <EOL> class BlogFeed ( Feed ) : <EOL> """<STR_LIT>""" <EOL> def get_object ( self , bits ) : <EOL> if len ( bits ) > <NUM_LIT:1> : <EOL> raise ObjectDoesNotExist <EOL> elif len ( bits ) == <NUM_LIT:1> : <EOL> return Blog . objects . filter ( slug = bits [ <NUM_LIT:0> ] ) <EOL> else : <EOL> return Blog . objects . all ( ) <EOL> def title ( self , obj ) : <EOL> if obj . count ( ) > <NUM_LIT:1> : <EOL> return "<STR_LIT>" <EOL> else : <EOL> return obj [ <NUM_LIT:0> ] . title <EOL> def link ( self , obj ) : <EOL> if obj . count ( ) > <NUM_LIT:1> : <EOL> return '<STR_LIT>' <EOL> else : <EOL> try : <EOL> return '<STR_LIT>' % obj [ <NUM_LIT:0> ] . slug <EOL> except : <EOL> raise Http404 <EOL> def description ( self , obj ) : <EOL> if obj . count ( ) > <NUM_LIT:1> : <EOL> return "<STR_LIT>" <EOL> else : <EOL> return obj [ <NUM_LIT:0> ] . description <EOL> author_name = "<STR_LIT>" <EOL> author_email = "<STR_LIT>" <EOL> categories = ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> copyright = "<STR_LIT>" % date . today ( ) . year <EOL> def items ( self , obj ) : <EOL> return Entry . get_published . filter ( blog__in = obj ) [ : <NUM_LIT:20> ] <EOL> def item_link ( self , item ) : <EOL> return item . get_absolute_url ( ) <EOL> def item_author_name ( self , item ) : <EOL> if item . byline : <EOL> return item . byline <EOL> elif item . static_byline : <EOL> return item . static_byline <EOL> else : <EOL> return '<STR_LIT>' <EOL> def item_pubdate ( self , item ) : <EOL> return item . pub_date <EOL> def item_copyright ( self , item ) : <EOL> return "<STR_LIT>" % item . pub_date . year </s>
