Search for the html formatted date when testing for existing
authorDeryck Hodge <deryck@samba.org>
Tue, 1 Feb 2005 05:34:21 +0000 (05:34 +0000)
committerDeryck Hodge <deryck@samba.org>
Tue, 1 Feb 2005 05:34:21 +0000 (05:34 +0000)
dates on news.samba.org pages.

This fixes a bug in my news script that was grouping older
posts in odd pairs and under incorrect dates.

deryck

git-svn-id: file:///home/svn/samba-web/trunk@538 44aeb9d7-1cd8-0310-b257-a505e0beeac2

scripts/updateNews.py

index af37dc40706294b5cd28f7e6ab8b59bf9d32aac8..85b83cf778744ef2d80c5745b7d57fad918bd332 100755 (executable)
@@ -85,7 +85,7 @@ 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(h2date) > -1:
+    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')
@@ -127,7 +127,7 @@ def archive(dir, files):
         news_text = "".join(stories_by_date[date])
         h2date = date_to_str(time.gmtime(date)[:3])
         index = open('index.html', 'a')
-        if open('index.html', 'r').read().find(h2date) > -1:
+        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')