<s> """<STR_LIT>""" <EOL> from django . views . generic . list import ListView <EOL> from django . utils . translation import ugettext as _ <EOL> from zinnia . models . entry import Entry <EOL> from zinnia . settings import PAGINATION <EOL> from zinnia . views . mixins . prefetch_related import PrefetchCategoriesAuthorsMixin <EOL> class BaseEntrySearch ( object ) : <EOL> """<STR_LIT>""" <EOL> pattern = '<STR_LIT>' <EOL> error = None <EOL> def get_queryset ( self ) : <EOL> """<STR_LIT>""" <EOL> entries = Entry . published . none ( ) <EOL> if self . request . GET : <EOL> self . pattern = self . request . GET . get ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> if len ( self . pattern ) < <NUM_LIT:3> : <EOL> self . error = _ ( '<STR_LIT>' ) <EOL> else : <EOL> entries = Entry . published . search ( self . pattern ) <EOL> else : <EOL> self . error = _ ( '<STR_LIT>' ) <EOL> return entries <EOL> def get_context_data ( self , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> context = super ( BaseEntrySearch , self ) . get_context_data ( ** kwargs ) <EOL> context . update ( { '<STR_LIT:error>' : self . error , '<STR_LIT>' : self . pattern } ) <EOL> return context <EOL> class EntrySearch ( PrefetchCategoriesAuthorsMixin , <EOL> BaseEntrySearch , <EOL> ListView ) : <EOL> """<STR_LIT>""" <EOL> paginate_by = PAGINATION <EOL> template_name_suffix = '<STR_LIT>' </s>
