[Moin-user] fix for python 2.4.2c1
Andrea Arcangeli
andrea at cpushare.com
Tue Oct 11 19:43:48 EDT 2005
Hello,
I am trying moinmoin (1.3 branch) with python 2.4.2c1 and the PageHits
macro returned an exception.
Not sure if this is fully correct but at least it works now. I also had
to delete the cache after applying the patch to fixup the pickle.
Thanks.
* looking for arch at arch.thinkmo.de--2003-archives/moin--main--1.3--patch-935 to compare with
* comparing to arch at 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
More information about the Moin-user
mailing list