[Cheetahtemplate-discuss] NoneType error running Python 2.5
Brought to you by:
rtyler,
tavis_rudd
From: Wim S. <wim...@ho...> - 2006-09-23 05:50:23
|
Switching to Python 2.5 while using Cheetah-2.0rc7 produces this error: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D File "c:\progra~1\python25\lib\site-packages\Cheetah\NameMapper.py", = line 212, in _valueForName if hasattr(obj, 'has_key') and obj.has_key(key): TypeError: 'NoneType' object is not = callable=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3DThis patch in NameMapper.py solved the = problem: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D def _valueForName(obj, name, executeCallables=3DFalse): nameChunks=3Dname.split('.') for i in range(len(nameChunks)): key =3D nameChunks[i] ############# patched by WimS ############### if (type(obj) =3D=3D dict) and obj.has_key(key): # if hasattr(obj, 'has_key') and obj.has_key(key): ############# patched by WimS ############### nextObj =3D obj[key] elif hasattr(obj, key): nextObj =3D getattr(obj, key) else: _raiseNotFoundException(key, obj) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Greetings, WimS |