SVN: security/cve_reader.py
megabajt
megabajt at pld-linux.org
Fri Oct 19 18:22:17 CEST 2007
Author: megabajt
Date: Fri Oct 19 18:22:17 2007
New Revision: 8830
Modified:
security/cve_reader.py
Log:
- reverse sequence in the XMLFILE (newer items at the beginning)
Modified: security/cve_reader.py
==============================================================================
--- security/cve_reader.py (original)
+++ security/cve_reader.py Fri Oct 19 18:22:17 2007
@@ -129,29 +129,25 @@
ET.SubElement(package, "revision").text = revision
ET.SubElement(package, "resolved").text = resolved
ET.SubElement(package, "cves").text = cve
-
+
if len(rootnode) == 0:
# rootnode is empty and has no children. I can easily add new (without sorting)
rootnode.append(package)
else:
prevdate = ""
- # Maybe new entry can be added at the end? I need check it.
- item = len(rootnode) - 1
- while(item >= 0):
-
+ # Maybe new entry can be added at the beginning? I need check it.
+ for item in range(len(rootnode)):
subitem = getTagIndex(rootnode[item], 'date')
prevdate = rootnode[item][subitem].text
if cmp(prevdate, date) <= 0:
- rootnode.insert(item + 1, package)
+ rootnode.insert(item, package)
return
- item = item - 1
-
# Huh, new entry is the youngest one
- rootnode.insert(0, package)
+ rootnode.insert(len(rootnode), package)
def getTagIndex(node, tag):
item = ""
@@ -237,18 +233,18 @@
def genRSSFeed(rootnode):
rssitem = []
- if len(rootnode) - RSSITEMS < 0:
- start = 0
+ if RSSITEMS > len(rootnode):
+ end = len(rootnode)
else:
- start = len(rootnode) - RSSITEMS
+ end = RSSITEMS
- for item in range(start, len(rootnode)):
+ for item in range(end):
pkg = getPackageData(rootnode[item], ['date', 'spec', 'revision', 'cves'])
# date[0] - year; date[1] - month; date[2] - day
date = pkg['date'].split('/')
- rssitem.append(
+ rssitem.insert(0,
PyRSS2Gen.RSSItem(
title = "New CVE fixes for %s" % pkg['spec'],
description = "%s on rev. %s resolves: %s" % (pkg['spec'], pkg['revision'], pkg['cves']),
More information about the pld-cvs-commit
mailing list