[PEAK] Extending built-in function unicode
Rajeev J Sebastian
rajeev.sebastian at gmail.com
Mon Oct 6 07:56:23 EDT 2008
Hi,
I'm using PEAK_Rules-0.5a1.dev_r2576-py2.4
I get an exception when trying to "extend" the unicode function:
@when(unicode, (types.ClassType,))
def unicode_model(m):
return m._meta.app_label+'.'+m._meta.object_name
( this is to print a good string when the object 'm' is a django model class)
However, I get something like:
AttributeError: type object 'unicode' has no attribute 'func_code'
when this code loads.
It seems this is because 'unicode' is not a python function (?). Could
someone suggest a better way to achieve this ?
Regards
Rajeev J Sebastian
Partial Traceback:
File "build\bdist.win32\egg\peak\util\decorators.py", line 600, in do_decorate
File "/usr/lib/python2.4/site-packages/PEAK_Rules-0.5a1.dev_r2576-py2.4.egg/peak/rules/core.py",
line 185, in callback
File "/usr/lib/python2.4/site-packages/PEAK_Rules-0.5a1.dev_r2576-py2.4.egg/peak/rules/core.py",
line 309, in rules_for
File "/usr/lib/python2.4/site-packages/PEAK_Rules-0.5a1.dev_r2576-py2.4.egg/peak/rules/core.py",
line 547, in callback
File "/usr/lib/python2.4/site-packages/PEAK_Rules-0.5a1.dev_r2576-py2.4.egg/peak/rules/core.py",
line 153, in __call__
File "/usr/lib/python2.4/site-packages/PEAK_Rules-0.5a1.dev_r2576-py2.4.egg/peak/rules/core.py",
line 312, in rules_for
File "build\bdist.win32\egg\peak\util\addons.py", line 55, in __call__
File "/usr/lib/python2.4/site-packages/PEAK_Rules-0.5a1.dev_r2576-py2.4.egg/peak/rules/core.py",
line 334, in __init__
File "/usr/lib/python2.4/site-packages/PEAK_Rules-0.5a1.dev_r2576-py2.4.egg/peak/rules/core.py",
line 358, in _regen_code
File "build\bdist.win32\egg\peak\util\assembler.py", line 858, in
from_function
AttributeError: type object 'unicode' has no attribute 'func_code'
More information about the PEAK
mailing list