<s> from acrylamid . views import View <EOL> from acrylamid . helpers import union , joinurl , event <EOL> from os . path import exists <EOL> class Articles ( View ) : <EOL> """<STR_LIT>""" <EOL> priority = <NUM_LIT> <EOL> def init ( self , conf , env , template = '<STR_LIT>' ) : <EOL> self . template = template <EOL> def generate ( self , conf , env , data ) : <EOL> entrylist = data [ '<STR_LIT>' ] <EOL> tt = env . engine . fromfile ( env , self . template ) <EOL> path = joinurl ( conf [ '<STR_LIT>' ] , self . path , '<STR_LIT>' ) <EOL> if exists ( path ) and not ( conf . modified or env . modified or tt . modified ) : <EOL> event . skip ( '<STR_LIT>' , path ) <EOL> raise StopIteration <EOL> articles = { } <EOL> for entry in entrylist : <EOL> articles . setdefault ( ( entry . year , entry . imonth ) , [ ] ) . append ( entry ) <EOL> html = tt . render ( conf = conf , articles = articles , env = union ( env , <EOL> num_entries = len ( entrylist ) , route = self . path ) ) <EOL> yield html , path </s>
