diff -u -r1.2 Blog.py
--- Blog.py	12 Jun 2006 17:05:23 -0000	1.2
+++ Blog.py	13 Jun 2006 16:20:46 -0000
@@ -48,11 +48,15 @@
     $Id$
 """
 
-from MoinMoin import config, wikiutil
+from MoinMoin import config
 from MoinMoin.Page import Page
-import re, time, string
+import re, time
 import MoinMoin.macro.Include
 
+# compile regular expressions once at start time
+re_entries=re.compile(r'(?P<entries>\d+)')
+re_date=re.compile(r'(?P<year>\d\d\d\d)-(?P<month>\d?\d)-(?P<day>\d?\d)')
+
 def getStyle():
     style = """
 <style type="text/css">
@@ -111,7 +115,7 @@
 }
 
 function updateBlog() {
-    window.location.href = global.page+"?date="+global.date+"&entries="+global.entries+"&showAll="+global.showAll
+    window.location.href = "/"+global.page+"?date="+global.date+"&entries="+global.entries+"&showAll="+global.showAll
 }
 
 function setToday() {
@@ -378,23 +382,21 @@
 #def execute(macro, text, args_re=re.compile(_args_re_pattern)):
 
 def execute(macro, text):
-    thisPage = macro.formatter.page.url(macro.request)
-
+    thisPage = macro.formatter.page.page_name
 
     #get incoming macro args, else set to []
     if text:
-        args = string.split(text, ",")
+        args = text.split(",")
     else:
         args = []
 
     #remove all leading and trailing spaces
-    for i in range(len(args)):
-        args[i] = string.strip(args[i])
+    args = map(lambda line: line.strip(), args)
 
     #set date
     if macro.form.has_key('date'):
         date = macro.form['date'][0]
-    elif (len(args) >= 0) and (not args[0] == ""):
+    elif (len(args) > 0) and (args[0]):
         date = args[0]
     else:
         date = ""
@@ -403,7 +405,7 @@
     #set showAll
     if macro.form.has_key('showAll'):
         showAll = macro.form['showAll'][0]
-    elif (len(args) >= 1) and (not args[1] == ""):
+    elif (len(args) > 1) and (args[1]):
         showAll = args[1]
     else:
         showAll = "0"
@@ -411,29 +413,28 @@
     #set entries
     if macro.form.has_key('entries'):
         entries = macro.form['entries'][0]
-    elif (len(args) >= 2) and (not args[2] == ""):
+    elif (len(args) > 2) and (args[2]):
         entries = args[2]
     else:
-        entries = -1
+        entries = None
 
     #set max entries
-    if (len(args) >= 3) and (not args[3] == ""):
+    if (len(args) > 3) and (args[3]):
         maxEntries = int(args[3])
         if maxEntries < 0:
             maxEntries = 20
     else:
         maxEntries = 20
 
-    if (len(args) >= 4) and (not args[4] == ""):
+    if (len(args) > 4) and (args[4]):
         startDay = args[4]
     else:
         startDay = "Mo";
 
 
     #set the number of visible entries
-    if not entries == -1:
-        args_re=re.compile(r'(?P<entries>\d+)')
-        args = args_re.match(entries)
+    if entries:
+        args = re_entries.match(entries)
         if not args:
             return ('<p><strong class="error">%s</strong></p>' %('Invalid entries "%s"!')) % (macro.form['beforeDate'][0])
         entries = int(macro.form['entries'][0])
@@ -446,8 +447,7 @@
 
     #get the date
     if not date == "":
-        args_re=re.compile(r'(?P<year>\d\d\d\d)-(?P<month>\d?\d)-(?P<day>\d?\d)')
-        args = args_re.match(date)
+        args = re_date.match(date)
         if not args:
             return ('<p><strong class="error">%s</strong></p>' %('Invalid date "%s"!')) % (macro.form['date'][0])
         year  = int(args.group('year'))
@@ -465,7 +465,7 @@
     if (showAll == '1'):
         ret += getShowAll(macro, thisPage, year, month, day, entries, maxEntries)
     else:
-        ret += getShowEntered(macro, macro.formatter.page.page_name, year, month, day, entries, maxEntries)
+        ret += getShowEntered(macro, thisPage, year, month, day, entries, maxEntries)
 
     return ret
 
@@ -482,7 +482,7 @@
     ret += "</select>"
 
     for i in range(entries):
-        includeParams = '%s/BlogEntry-%d-%02d-%02d, "%d-%02d-%02d", 1' % (macro.formatter.page.page_name, year, month, day, year, month, day)
+        includeParams = '%s/BlogEntry-%d-%02d-%02d, "%d-%02d-%02d", 1' % (thisPage, year, month, day, year, month, day)
         ret += MoinMoin.macro.Include.execute(macro, includeParams)
         #date = strftime("%Y-%m-$d", (year,month,day, 0, 0, 0, 0, 0, 0)
         day = day - 1
