Logo Search packages:      
Sourcecode: yum-utils version File versions  Download package

def repo-rss::RepoRSS::rsspkg (   self,
  pkg,
  url 
)
takes a pkg object and repourl for the pkg object

Definition at line 114 of file repo-rss.py.

                              :
        """takes a pkg object and repourl for the pkg object"""
        
        rfc822_format = "%a, %d %b %Y %X GMT"
        clog_format = "%a, %d %b %Y GMT"
        xhtml_ns = "http://www.w3.org/1999/xhtml"
        escape = self.xmlescape
        
        item = self.rssnode.newChild(None, 'item', None)
        title = escape(str(pkg))
        item.newChild(None, 'title', title)
        date = time.gmtime(float(pkg.returnSimple('buildtime')))
        item.newChild(None, 'pubDate', time.strftime(rfc822_format, date))
        item.newChild(None, 'guid', pkg.returnSimple('id')).setProp("isPermaLink", "false")        
        link = url + '/' + pkg.returnSimple('relativepath')
        item.newChild(None, 'link', escape(link))
    
        # build up changelog
        changelog = ''
        cnt = 0
        if (pkg.changelog != None):
            where = pkg.changelog
        else:
            where = pkg.returnChangelog()
        for e in where:
            cnt += 1
            if cnt > 3: 
                changelog += '...'
                break
            (date, author, desc) = e
            date = time.strftime(clog_format, time.gmtime(float(date)))
            changelog += '%s - %s\n%s\n\n' % (date, author, desc)
        description = '<p><strong>%s</strong> - %s</p>\n\n' % (escape(pkg.name), 
                                            escape(pkg.returnSimple('summary')))
        description += '<p>%s</p>\n\n<p><strong>Change Log:</strong></p>\n\n' % escape(pkg.returnSimple('description').encode('utf-8').replace("\n", "<br />\n"))
        description += escape('<pre>%s</pre>' % escape(to_unicode(changelog).encode('utf-8')))
        item.newChild(None, 'description', description)
        
        return item
        


Generated by  Doxygen 1.6.0   Back to index