def show_unread(self, rssid): t = Template() t.load(os.path.join(Globals.workpath, 'plugins/rssreader/unread_message.py'), 'python') RssDb.init(Globals.rss_dbfile) feed = RssDb.Feed.get(rssid) data = RssDb.Data.select(RssDb.and_(RssDb.Data.c.feed_id==rssid, RssDb.Data.c.read==False), order_by=[RssDb.desc(RssDb.Data.c.pubDate)]) x = dict4ini.DictIni() x.html.chanel_title = feed.title x.html.chanel_url = feed.link x.html.chanel_image_url = feed.imagelink x.html.newsletter = [] for i in data: v = dict4ini.DictIni() v.title = i.title v.link = i.link v.description = i.description v.date = i.pubDate.strftime("%Y-%m-%d %H:%M:%S") v.comments = i.comments v.comments_gif = ('file:///' + os.path.join(Globals.workpath, 'plugins/rssreader/comments.png').replace(':', '|')).replace('\\', '/') x.html.newsletter.append(v) text = t.value('html', x.dict(), encoding='utf-8') filename = os.path.join(tempfile.gettempdir(), 'rssreader.html') file(filename, 'w').write(text) self.publisher.sendMessage('change_html', filename)