[Zope-CMF] taL: test evaluates all arguments

robert rottermann robert@redcor.ch
Fri, 3 Jan 2003 21:59:17 +0100


if have the following tal statement:

tal:define=3D"resp_def  python:here.users_with_local_role('ObjectResponsi=
ble');
         responsible python:test(resp_def =3D=3D [], '', resp_def[0]);"

When resp_def is an empty list I get an index out of range error.
This seems very strange.

can anybody give me a hint what goes wrong here ??

I am using Zope2.6.1b1

thanks
Robert


Exception Type  IndexError
Exception Value list index out of range

Traceback (innermost last):

    * Module ZPublisher.Publish, line 98, in publish
    * Module ZPublisher.mapply, line 88, in mapply
    * Module ZPublisher.Publish, line 39, in call_object
    * Module Shared.DC.Scripts.Bindings, line 252, in __call__
    * Module Shared.DC.Scripts.Bindings, line 283, in _bindAndExec
    * Module Products.CMFCore.FSPageTemplate, line 189, in _exec
    * Module Products.CMFCore.FSPageTemplate, line 122, in pt_render
    * Module Products.PageTemplates.PageTemplate, line 95, in pt_render
      <FSPageTemplate at /AA/plone/content_status_history used for=20
/AA/plone/Members/robert>
    * Module TAL.TALInterpreter, line 186, in __call__
    * Module TAL.TALInterpreter, line 230, in interpret
    * Module TAL.TALInterpreter, line 689, in do_useMacro
    * Module TAL.TALInterpreter, line 230, in interpret
    * Module TAL.TALInterpreter, line 712, in do_defineSlot
    * Module TAL.TALInterpreter, line 230, in interpret
    * Module TAL.TALInterpreter, line 655, in do_condition
    * Module TAL.TALInterpreter, line 230, in interpret
    * Module TAL.TALInterpreter, line 655, in do_condition
    * Module TAL.TALInterpreter, line 230, in interpret
    * Module TAL.TALInterpreter, line 459, in do_setLocal_tal
    * Module Products.PageTemplates.TALES, line 217, in evaluate
      Line 186, Column 20
      Expression: <PythonExpr test(resp_def =3D=3D [], '', resp_def[0])>
      Names:

{'container': <PloneSite instance at 9096490>,
 'default': <Products.PageTemplates.TALES.Default instance at 0x86d8d94>,
 'here': <PloneFolder instance at 9260f48>,
 'loop': <SafeMapping instance at 9016de0>,
 'modules': <Products.PageTemplates.ZRPythonExpr._SecureModuleImporter=20
instance at 0x86ea964>,
 'nothing': None,
 'options': {'args': ()},
 'repeat': <SafeMapping instance at 9016de0>,
 'request': <HTTPRequest,=20
URL=3Dhttp://localhost:8080/AA/plone/Members/robert/portal_form/content_s=
tatus_history>,
 'root': <Application instance at 906b938>,
 'template': <FSPageTemplate at /AA/plone/content_status_history used for=
=20
/AA/plone/Members/robert>,
 'traverse_subpath': [],
 'user': robert}

    * Module Products.PageTemplates.ZRPythonExpr, line 48, in __call__
      __traceback_info__: test(resp_def =3D=3D [], '', resp_def[0])
    * Module Python expression "test(resp_def =3D=3D [], '', resp_def[0])=
", line=20
2, in f
    * Module AccessControl.ZopeGuards, line 90, in guarded_getitem

IndexError: list index out of range