svn commit: samba-web r594 - in trunk/scripts: .

deryck at samba.org deryck at samba.org
Sun Mar 20 02:31:41 GMT 2005


Author: deryck
Date: 2005-03-20 02:31:41 +0000 (Sun, 20 Mar 2005)
New Revision: 594

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba-web&rev=594

Log:

Don't include <a> links from article in RSS feed blurbs.
Easiest way to avoid malformed XML.

deryck

Modified:
   trunk/scripts/updateNews.py


Changeset:
Modified: trunk/scripts/updateNews.py
===================================================================
--- trunk/scripts/updateNews.py	2005-03-19 10:17:58 UTC (rev 593)
+++ trunk/scripts/updateNews.py	2005-03-20 02:31:41 UTC (rev 594)
@@ -206,10 +206,16 @@
 		title = re.search('(?<=\"\>).+(?=\<\/a)', item_text)
 		link = re.search('(?<=\<div class=\"reference\">Link: \<a href=\"/samba/news/).+(?=\"\>)', item_text)
 
-		# Index out the HTML tags for XML
+		# Index by <p> to find first paragraph, but 
+		# leave out the tags for XML
 		begin = item_text.find('<p>') + 3
 		end = item_text.find('</p>') 
 		descrip = item_text[begin:end]
+		# Remove links to avoid malformed XML
+		a_begin = re.compile('<a href="(.*)">')
+		a_end = re.compile('</a>')
+		descrip = a_begin.sub('', descrip)
+		descrip = a_end.sub('', descrip)
 
 		feed.write('<item>\n')
 		feed.write('<title>' + title.group(0) + '</title>\n')



More information about the samba-cvs mailing list