[ZPT] repeat index?
Sim Harbert
sim.harbert@zapmedia.com
Thu, 26 Apr 2001 18:00:14 -0400
I second that.
And could we have a bit more documentation about exactly what is available in the 'repeat' context? I can get
'number' to work either. I am using release 1.1.1. I have looked at the code, but it is taking me a while to
digest it all.
-Sim
Brent Hendricks wrote:
> Hi,
>
> I'm having trouble getting at the repeat index. Using the following
> code (based on the code in the TAL spec):
>
> <p tal:repeat="txt python:'one', 'two', 'three'">
> <span tal:replace="repeat/txt/index"/> : <span tal:replace="txt" />
> </p>
>
> I expected to get the following:
> <p>
> 1 : one
> </p>
> <p>
> 2 : two
> <p>
> 3 : three
> </p>
>
> But instead I get an error message:
>
> Unauthorized on index in ""
>
> Here is the traceback:
>
> Traceback (innermost last):
> File /usr/local/zope-2.3.2b2/lib/python/ZPublisher/Publish.py, line 223, in publish_module
> File /usr/local/zope-2.3.2b2/lib/python/ZPublisher/Publish.py, line 187, in publish
> File /usr/local/zope-2.3.2b2/lib/python/Zope/__init__.py, line 221, in zpublisher_exception_hook
> (Object: Traversable)
> File /usr/local/zope-2.3.2b2/lib/python/ZPublisher/Publish.py, line 171, in publish
> File /usr/local/zope-2.3.2b2/lib/python/ZPublisher/mapply.py, line 160, in mapply
> (Object: iterate.html)
> File /usr/local/zope-2.3.2b2/lib/python/ZPublisher/Publish.py, line 112, in call_object
> (Object: iterate.html)
> File /usr/local/zope-2.3.2b2/lib/python/Shared/DC/Scripts/Bindings.py, line 324, in __call__
> (Object: iterate.html)
> File /usr/local/zope-2.3.2b2/lib/python/Shared/DC/Scripts/Bindings.py, line 354, in _bindAndExec
> (Object: iterate.html)
> File /usr/local/zope-2.3.2b2/lib/python/Products/PageTemplates/ZopePageTemplate.py, line 246, in _exec
> (Object: iterate.html)
> File /usr/local/zope-2.3.2b2/lib/python/Products/PageTemplates/PageTemplate.py, line 153, in pt_render
> (Object: iterate.html)
> File /usr/local/zope-2.3.2b2/lib/python/TAL/TALInterpreter.py, line 197, in __call__
> File /usr/local/zope-2.3.2b2/lib/python/TAL/TALInterpreter.py, line 224, in interpret
> File /usr/local/zope-2.3.2b2/lib/python/TAL/TALInterpreter.py, line 392, in do_useMacro
> File /usr/local/zope-2.3.2b2/lib/python/TAL/TALInterpreter.py, line 224, in interpret
> File /usr/local/zope-2.3.2b2/lib/python/TAL/TALInterpreter.py, line 401, in do_defineSlot
> File /usr/local/zope-2.3.2b2/lib/python/TAL/TALInterpreter.py, line 224, in interpret
> File /usr/local/zope-2.3.2b2/lib/python/TAL/TALInterpreter.py, line 364, in do_loop
> File /usr/local/zope-2.3.2b2/lib/python/TAL/TALInterpreter.py, line 224, in interpret
> File /usr/local/zope-2.3.2b2/lib/python/TAL/TALInterpreter.py, line 314, in do_insertText
> File /usr/local/zope-2.3.2b2/lib/python/Products/PageTemplates/TALES.py, line 267, in evaluateText
> File /usr/local/zope-2.3.2b2/lib/python/Products/PageTemplates/TALES.py, line 257, in evaluate
> File /usr/local/zope-2.3.2b2/lib/python/Products/PageTemplates/Expressions.py, line 173, in __call__
> File /usr/local/zope-2.3.2b2/lib/python/Products/PageTemplates/Expressions.py, line 383, in restrictedTraverse
> (Info: [])
> File /usr/local/zope-2.3.2b2/lib/python/AccessControl/SecurityManager.py, line 144, in validate
> File /usr/local/zope-2.3.2b2/lib/python/AccessControl/ZopeSecurityPolicy.py, line 168, in validate
> TALESError: (see above)
>
> Am I doing something incorrectly or is this a bug? I'm using
> TAL-1.1.0 and PageTemplates-1.1.1
>
> Thanks,
> Brent Hendricks
>
> -------------------------------------------------------------------------
>
> "The programmer, like the poet, works only slightly removed from pure
> thought-stuff. He builds his castles in the air, from air, creating
> by exertion of the imagination. Few media of creation are so
> flexible, so easy to polish and rework, so readily capable of
> realizing grand conceptual structures."
> -- Frederick Brooks, Jr., The Mythical Man Month
>
> _______________________________________________
> ZPT mailing list
> ZPT@zope.org
> http://lists.zope.org/mailman/listinfo/zpt