#NEWLINE# def write_atom( ) : #NEWLINE# #INDENT# env = Environment ( loader = PackageLoader ( 'rstdiary' , 'templates' ) ) #NEWLINE# template = env . get_template ( 'atom.xml' ) #NEWLINE# output_dir = config . get ( 'rstdiary' , 'output_dir' ) #NEWLINE# month = all_months [ 0 ] #NEWLINE# month_entries = all_entries [ month ] #NEWLINE# month_entries . sort ( key = ( lambda e : e . date ) , reverse = True ) #NEWLINE# output = template . render ( title = config . get ( 'rstdiary' , 'title' ) , site_root = config . get ( 'rstdiary' , 'site_root' ) , author_name = config . get ( 'rstdiary' , 'author_name' ) , month = template , updated = ( datetime . utcnow ( ) . isoformat ( 'T' ) + 'Z' ) , month_entries = month_entries ) #NEWLINE# filename = os . path . join ( output_dir , 'atom.xml' ) #NEWLINE# logging . debug ( ( 'Writing atom feed for %s to %s' % ( month , filename ) ) ) #NEWLINE# with codecs . open ( filename , 'w' , 'utf-8' ) as f : #NEWLINE# #INDENT# f . write ( output )