New submission from do3cc <>:

This occurs in plone, after changing the Missing class to at least provide the
__class__ attribute.

01>                _content = _path(item, econtext['request'], True,
02>                u'_content'
03>                _write(u'<span>')
04>                _tmp3 = _content
05>                _tmp = _tmp3
06>                if (_tmp.__class__ not in (str, unicode, int, float, )):
07>                    try:
08>                        _tmp = _tmp.__html__
09>                    except:
10>                        _tmp = _translate(_tmp, domain=_domain, mapping=None,
target_language=target_language, default=None)
11>                    else:
12>                        _tmp = _tmp()
13>                        _write(_tmp)
14>                        _tmp = None

Line 01 returns a very basic ExtensionClass object. This very basic
extension class has no __class__ attribute. I added it in a branch of
the 'Missing' package.
In 06 and 10 it starts doing some wrong assumptions for our case, and
tries to translate the missing value.
Translation throws an Unhashable Exception, because the 'Missing' object
is not hashable. Gettext requires hashable msgids

The attached patch provides a test case that triggers the described behaviour.

messages: 415
nosy: do3cc
priority: bug
status: unread
title: Chameleon treats every non simple object as a msgid. Non hashable 
objects will throw exceptions when being used as msg ids

Repoze Bugs <>
Repoze-dev mailing list

Reply via email to