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

deryck at samba.org deryck at samba.org
Mon May 8 00:42:59 GMT 2006


Author: deryck
Date: 2006-05-08 00:42:58 +0000 (Mon, 08 May 2006)
New Revision: 983

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

Log:
Only show the last 40 stories on the main news page.

deryck


Modified:
   trunk/scripts/updateNews.py


Changeset:
Modified: trunk/scripts/updateNews.py
===================================================================
--- trunk/scripts/updateNews.py	2006-05-05 20:45:34 UTC (rev 982)
+++ trunk/scripts/updateNews.py	2006-05-08 00:42:58 UTC (rev 983)
@@ -87,17 +87,22 @@
 index.write('<!--#include virtual="/samba/news/header2.html" -->\n\n')
 index.close()
 
+# Only list the 40 most recent stories on the main news page
+count = 40
 for date in post_dates:
-    news_text = all_stories[date]
-    h2date = date_to_str(time.gmtime(date)[:3])
-    index = open('index.html', 'a')
-    if open('index.html', 'r').read().find('<h2>' + h2date + '</h2>\n\n') >= 0:
-        index.write(news_text)
-    else:    
-        index.write('<h2>' + h2date + '</h2>\n\n')
-        index.write(news_text)
-    index.close()
 
+    if count > 0:
+        news_text = all_stories[date]
+        h2date = date_to_str(time.gmtime(date)[:3])
+        index = open('index.html', 'a')
+        if open('index.html', 'r').read().find('<h2>' + h2date + '</h2>\n\n') >= 0:
+            index.write(news_text)
+        else:    
+            index.write('<h2>' + h2date + '</h2>\n\n')
+            index.write(news_text)
+        index.close()
+        count = count - 1
+
 index = open('index.html', 'a')
 index.write('<!--#include virtual="/samba/news/footer.html" -->\n\n')
 index.close()



More information about the samba-cvs mailing list