Apologies for the cross post ( and direct post), not sure whether this
should be in Pylons discuss or Repoze these days.

I'm trying to use a recursive metal macro in a zpt template in a pyramid
app, from what I can tell, the following should work, but I don't know what'

   <ul metal:define-macro="comment_list">
      <li tal:repeat="comment comments" class="comment" comment_id="${
        <div>ID: ${comment.id} ${comment.body}</div>
        <div tal:define="comments comment.children">
          <ul metal:use-macro="comment_list" />

I have verified that comment.children is legit. I get the following error
message, which seems to imply the use of the macro within it's definition is
not allowed, but from I've found on line, that's supposed to be part of the
ZPT spec. ( maybe I am wrong? ) If anyone can tell me what I'm doing wrong
or how to do this, or whether this is actually a bug in the Chameleon
implementation, that would be great!


    raise NameError(key)
RenderError: An uncaught exception was raised.

NameError: comment_list

 - Expression: "comment_list"
 - Filename:   /home/REDACTED/templates/content_view.pt
 - Location:   (14:31)
 - Arguments:  resource_id: <long - at 0xb2cbba0>
               renderer_info: <RendererHelper - at 0xafc224c>
               attrs: {...} (1)
               title: Page - View
               form_action: <NoneType - at 0x8231098>
               comments: <list - at 0xb42dfcc>
               decode: <type unicode at 0x8236f80>
               macros: <Macros - at 0xae3a47c>
               resource_path: page
               template: <PageTemplateFile - at 0xb1c2a4c>
               translate: <function fast_translate at 0xa4e0bfc>
               repeat: {...} (1)
               renderer_name: REDACTED.templates:content_view.pt
               nothing: <NoneType - at 0x8231098>
               convert: <function fast_translate at 0xa4e0bfc>
               fields: <list - at 0xb42d80c>
               __error__: <list - at 0xb36fe8c>
               request: <Request - at 0xb42d86c>
               view_name: view
               context: <Page home at 0xb2dc20c>
               view: <ContentPublicViewAction - at 0xb2dc76c>
Repoze-dev mailing list

Reply via email to