#NEWLINE# def news_reply( username , sender , * items ) : #NEWLINE# #INDENT# item_template = '<item><Title><![CDATA[%(title)s]]></Title><Description><![CDATA[%(description)s]]></Description><PicUrl><![CDATA[%(picurl)s]]></PicUrl><Url><![CDATA[%(url)s]]></Url></item>' #NEWLINE# articles = [ ( item_template % o ) for o in items ] #NEWLINE# template = '<xml>%(shared)s<ArticleCount>%(count)d</ArticleCount><Articles>%(articles)s</Articles></xml>' #NEWLINE# dct = { #NEWLINE# #INDENT# 'shared' : _shared_reply ( username , sender , 'news' ) , #NEWLINE# 'count' : len ( items ) , #NEWLINE# 'articles' : '' . join ( articles ) , #NEWLINE# #UNINDENT# } #NEWLINE# return ( template % dct )