Description
FindPage cannot be opened at all. Wiki will fail with the following message in the log:
ERROR 2010-06-08 18:30:00,990 MoinMoin.macro:132 Macro AdvancedSearch (page: 'FindPage') raised an exception:
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/MoinMoin/macro/__init__.py", line 122, in execute
return execute(self, args)
File "/usr/lib/python2.6/site-packages/MoinMoin/macro/AdvancedSearch.py", line 189, in execute
return advanced_ui(macro)
File "/usr/lib/python2.6/site-packages/MoinMoin/macro/AdvancedSearch.py", line 141, in advanced_ui
(_('File Type'), unicode(mt_select), ''),
File "/usr/lib/python2.6/site-packages/MoinMoin/widget/html.py", line 131, in __unicode__
co = unicode(c)
File "/usr/lib/python2.6/site-packages/MoinMoin/widget/html.py", line 131, in __unicode__
co = unicode(c)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 3: ordinal not in range(128)
Steps to reproduce
Try to access FindPage.
Example
Component selection
I checked the code a little bit and found out that /etc/mime.types in Fedora 13 cannot get parsed. This is because there is "cubic" sign (g3) on one of the mime types.
application/vnd.geocube+xml g3 g³
This is line 355 of Fedora 13's /etc/mime.types
Details
MoinMoin Version |
1.9.2 |
OS and Version |
Fedora 13 |
Python Version |
2.6 |
Server Setup |
Fedora 13 Desktop Edition |
Server Details |
nothing specific |
Language you are using the wiki in (set in the browser/UserPreferences) |
en |
Workaround
1 Delete g³ from /etc/mime.types
2 I added some bypass code in .../wiki/widgets/html.py, line 125:
def __unicode__(self):
#logging.info("Called CompositeElement unicode")
childout = []
for c in self.children:
#logging.info("LogUnicode: %s", c)
try:
co = unicode(c)
except:
co = "Failed to convert to unicode"
logging.info("LogUnicodeAFTER: %s", co)
childout.append(co)
return "<%s>%s</%s>" % (
self._openingtag(),
u''.join(childout),
self.tagname(),
)
Discussion
In my opinion this should be properly fixed, as many files are now utf-8 encoded not ascii anymore.
It looks like the patch is at the wrong place. Can you try fixing it at the place where (encoded) data enters moin - by just decoding it there?
uncleremus, 2012-05-25: Here is another patch that might be in the "right place". Tested on my Fedora system (F16).
1 From 26dceeabfd3878b09c4becccf4bc2c5965d0cb6e Mon Sep 17 00:00:00 2001
2 From: Martin Wilck <martin.wilck@ts.fujitsu.com>
3 Date: Fri, 25 May 2012 18:23:54 +0200
4 Subject: [PATCH] Fix for http://moinmo.in/MoinMoinBugs/FindPage
5
6 ---
7 macro/AdvancedSearch.py | 2 +-
8 1 files changed, 1 insertions(+), 1 deletions(-)
9
10 diff --git a/macro/AdvancedSearch.py b/macro/AdvancedSearch.py
11 index ded9379..995af87 100644
12 --- a/macro/AdvancedSearch.py
13 +++ b/macro/AdvancedSearch.py
14 @@ -120,7 +120,7 @@ def advanced_ui(macro):
15 mt_select = makeSelection('mimetype',
16 [('', _('any mimetype'))] +
17 [(type, 'all %s files' % type) for type in getMimetypes()] +
18 - [(m[1], '*%s - %s' % m) for m in sorted(mimetypes.types_map.items())],
19 + [(m[1], '*%s - %s' % (unicode(m[0], 'utf-8'), m[1])) for m in sorted(mimetypes.types_map.items())],
20 mimetype, 3, True)
21
22 # misc search options (checkboxes)
23 --
24 1.7.7.6
Plan
- Priority:
- Assigned to:
- Status:
