[ZPT] Guarded_getattr woes..

Tony McDonald tony.mcdonald@ncl.ac.uk
Mon, 13 Aug 2001 17:36:28 +0100


Hi all,
I have this fragment of a pagetemplate;

<tbody tal:repeat="timetable_info
python:here.Actors.SQL_TT.timetable_info(semgroup='all', stage='1',
weeks='9')">
 
...

<td tal:attributes="bgcolor
python:test(timetable_info.semgroup==data.userinfo.semgroup, 'red',
'blue')"> blah </td>

Where data is a coresession object that holds various bits of info about the
'state' of a user. It is defined as 'global' in the body tag of the
PageTemplate.

It yields this traceback.

<!--
Traceback (innermost last):
  File /home/zope/Zope-2.4.0-src/lib/python/ZPublisher/Publish.py, line 223,
in publish_module
  File /home/zope/Zope-2.4.0-src/lib/python/ZPublisher/Publish.py, line 187,
in publish
  File /home/zope/Zope-2.4.0-src/lib/python/Zope/__init__.py, line 226, in
zpublisher_exception_hook
    (Object: LockableItem)
  File /home/zope/Zope-2.4.0-src/lib/python/ZPublisher/Publish.py, line 171,
in publish
  File /home/zope/Zope-2.4.0-src/lib/python/ZPublisher/mapply.py, line 160,
in mapply
    (Object: index_html)
  File /home/zope/Zope-2.4.0-src/lib/python/ZPublisher/Publish.py, line 112,
in call_object
    (Object: index_html)
  File /home/zope/Zope-2.4.0-src/lib/python/Shared/DC/Scripts/Bindings.py,
line 324, in __call__
    (Object: index_html)
  File /home/zope/Zope-2.4.0-src/lib/python/Shared/DC/Scripts/Bindings.py,
line 354, in _bindAndExec
    (Object: index_html)
  File 
/home/zope/Zope-2.4.0-src/lib/python/Products/PageTemplates/ZopePageTemplate
.py, line 265, in _exec
    (Object: index_html)
  File 
/home/zope/Zope-2.4.0-src/lib/python/Products/PageTemplates/PageTemplate.py,
line 156, in pt_render
    (Object: index_html)
  File /home/zope/Zope-2.4.0-src/lib/python/TAL/TALInterpreter.py, line 232,
in __call__
  File /home/zope/Zope-2.4.0-src/lib/python/TAL/TALInterpreter.py, line 265,
in interpret
  File /home/zope/Zope-2.4.0-src/lib/python/TAL/TALInterpreter.py, line 591,
in do_useMacro
  File /home/zope/Zope-2.4.0-src/lib/python/TAL/TALInterpreter.py, line 265,
in interpret
  File /home/zope/Zope-2.4.0-src/lib/python/TAL/TALInterpreter.py, line 614,
in do_defineSlot
  File /home/zope/Zope-2.4.0-src/lib/python/TAL/TALInterpreter.py, line 265,
in interpret
  File /home/zope/Zope-2.4.0-src/lib/python/TAL/TALInterpreter.py, line 591,
in do_useMacro
  File /home/zope/Zope-2.4.0-src/lib/python/TAL/TALInterpreter.py, line 265,
in interpret
  File /home/zope/Zope-2.4.0-src/lib/python/TAL/TALInterpreter.py, line 614,
in do_defineSlot
  File /home/zope/Zope-2.4.0-src/lib/python/TAL/TALInterpreter.py, line 265,
in interpret
  File /home/zope/Zope-2.4.0-src/lib/python/TAL/TALInterpreter.py, line 591,
in do_useMacro
  File /home/zope/Zope-2.4.0-src/lib/python/TAL/TALInterpreter.py, line 265,
in interpret
  File /home/zope/Zope-2.4.0-src/lib/python/TAL/TALInterpreter.py, line 547,
in do_loop_tal
  File /home/zope/Zope-2.4.0-src/lib/python/TAL/TALInterpreter.py, line 265,
in interpret
  File /home/zope/Zope-2.4.0-src/lib/python/TAL/TALInterpreter.py, line 562,
in do_condition
  File /home/zope/Zope-2.4.0-src/lib/python/TAL/TALInterpreter.py, line 265,
in interpret
  File /home/zope/Zope-2.4.0-src/lib/python/TAL/TALInterpreter.py, line 311,
in do_startTag
  File /home/zope/Zope-2.4.0-src/lib/python/TAL/TALInterpreter.py, line 380,
in attrAction_tal
  File /home/zope/Zope-2.4.0-src/lib/python/Products/PageTemplates/TALES.py,
line 304, in evaluateText
  File /home/zope/Zope-2.4.0-src/lib/python/Products/PageTemplates/TALES.py,
line 286, in evaluate
  File 
/home/zope/Zope-2.4.0-src/lib/python/Products/PageTemplates/ZRPythonExpr.py,
line 121, in __call__
    (Info: test(timetable_info.semgroup==data.userinfo.semgroup, 'red',
'blue'))
  File Python expression
"test(timetable_info.semgroup==data.userinfo.semgroup, 'red', 'blue')", line
2, in f
    (Object: guarded_getattr)
  File /home/zope/Zope-2.4.0-src/lib/python/AccessControl/ZopeGuards.py,
line 109, in guarded_getattr
TALESError: (see above)


Can anyone tell me why guarded_getattr is getting in the picture (and what I
need to do to perform some Stalinist-like revisionism on it - please, no
icepicks....)?

Thanks
Tone.
-- 
Dr Tony McDonald,  Assistant Director, FMCC, http://www.fmcc.org.uk/
The Medical School, Newcastle University Tel: +44 191 243 6140
A Zope list for UK HE/FE  http://www.fmcc.org.uk/mailman/listinfo/zope