<s> from __future__ import absolute_import , print_function , unicode_literals <EOL> from aldryn_apphooks_config . utils import get_app_instance <EOL> from django . contrib . sites . models import Site <EOL> from django . contrib . syndication . views import Feed <EOL> from django . core . urlresolvers import reverse <EOL> from django . utils . translation import ugettext as _ <EOL> from . models import Post <EOL> from . settings import get_setting <EOL> class LatestEntriesFeed ( Feed ) : <EOL> def __call__ ( self , request , * args , ** kwargs ) : <EOL> self . namespace , self . config = get_app_instance ( request ) <EOL> return super ( LatestEntriesFeed , self ) . __call__ ( request , * args , ** kwargs ) <EOL> def link ( self ) : <EOL> return reverse ( '<STR_LIT>' % self . namespace , current_app = self . namespace ) <EOL> def title ( self ) : <EOL> return _ ( '<STR_LIT>' ) % { '<STR_LIT>' : Site . objects . get_current ( ) . name } <EOL> def items ( self , obj = None ) : <EOL> return Post . objects . namespace ( self . namespace ) . published ( ) . order_by ( '<STR_LIT>' ) [ : <NUM_LIT:10> ] <EOL> def item_title ( self , item ) : <EOL> return item . safe_translation_getter ( '<STR_LIT:title>' ) <EOL> def item_description ( self , item ) : <EOL> if get_setting ( '<STR_LIT>' ) : <EOL> return item . safe_translation_getter ( '<STR_LIT>' ) <EOL> return item . safe_translation_getter ( '<STR_LIT>' ) <EOL> class TagFeed ( LatestEntriesFeed ) : <EOL> def get_object ( self , request , tag ) : <EOL> return tag <EOL> def items ( self , obj = None ) : <EOL> return Post . objects . published ( ) . filter ( tags__slug = obj ) [ : <NUM_LIT:10> ] </s>
