Description

PageHits raise exception with Python 2.4.2c1

Steps to reproduce

  1. ?

Details

MoinMoin Version

moin--main--1.3--patch-935

OS and Version

?

Python Version

2.4.2c1

Server Setup

?

Server Details

?

Workaround

Discussion

Was sent to the mailing list.

Patch included in the bug report:

* looking for arch@arch.thinkmo.de--2003-archives/moin--main--1.3--patch-935 to compare with
* comparing to arch@arch.thinkmo.de--2003-archives/moin--main--1.3--patch-935
M  MoinMoin/util/web.py
M  MoinMoin/macro/PageHits.py

* modified files

--- orig/MoinMoin/macro/PageHits.py
+++ mod/MoinMoin/macro/PageHits.py
@@ -20,7 +20,7 @@
     # Use protocol 1, binary format compatible with all python versions
     PICKLE_PROTOCOL = 1

-from MoinMoin import caching
+from MoinMoin import caching, config
 from MoinMoin.Page import Page
 from MoinMoin.logfile import eventlog, logfile

@@ -66,7 +66,7 @@
         for event in event_log.reverse():
             if event[0] <= cacheDate:
                 break
-            page = event[2].get('pagename', None)
+            page = event[2].get('pagename', None).decode(config.charset, 'replace')
             if page:
                 hits[page] = hits.get(page, 0) + 1
                 changed = True


--- orig/MoinMoin/util/web.py
+++ mod/MoinMoin/util/web.py
@@ -27,7 +27,7 @@
     """
     import cgi
     values = {}
-    for key, value in cgi.parse_qs(qstr).items():
+    for key, value in cgi.parse_qs(qstr.encode('ascii', 'replace')).items():
         if len(value) < 2:
             values[key] = ''.join(value)
     return values

The patch should be checked, It does not look correct.

Plan


CategoryMoinMoinBugFixed

MoinMoin: MoinMoinBugs/PageHitsError (last edited 2007-10-29 19:06:59 by localhost)