[Zope] Re: METAL question

Andreas Tille tillea at rki.de
Fri Sep 26 08:33:04 EDT 2003


On Thu, 25 Sep 2003, Dieter Maurer wrote:

>  > Currently I do the following:
>  >
>  >
>  >   <th>
>  >    <span tal:replace="structure python:form.item_a.get_value('title')">item_a</span>
>  >   </th>
>  >   <td tal:define="item_a request/item_a|nothing">
>  >      <input tal:replace="structure python:form.item_a.render(item_a)">
>  >   </td>
>  >
>  >   <th>
>
> <tal:attributes define="item  string:item_a">
>   <metal:macro define-macro="ItemControl">
>     <th tal:define="FormItem form/?item">
>       <span tal:replace="structure python:FormItem.get_value('title')">Item</span>
>     </th>
>     <td tal:define="ItemValue request/?item | nothing"
                                                        >
>       <input tal:replace="structure python:FormItem.render(ItemValue)">
>     </td>
>   </metal:macro>
> </tal:attributes>
>
> <tal:attributes define="item string:item_b">
>   <metal:macro use-macro="template/macros/ItemControl" />
> </tal:attributes>
Thanks for this promissing code, but unfortunately it does not really work.
Besides the synt6actical typo marked above I get the following error
(copied from /error.log):

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.PageTemplates.ZopePageTemplate, line 228, in _exec
  Module Products.PageTemplates.PageTemplate, line 95, in pt_render
   - <ZopePageTemplate at /Test/adr-Formulator/search.html>
  Module TAL.TALInterpreter, line 200, in __call__
  Module TAL.TALInterpreter, line 244, in interpret
  Module TAL.TALInterpreter, line 703, in do_useMacro
  Module TAL.TALInterpreter, line 244, in interpret
  Module TAL.TALInterpreter, line 414, in do_optTag_tal
  Module TAL.TALInterpreter, line 399, in do_optTag
  Module TAL.TALInterpreter, line 394, in no_tag
  Module TAL.TALInterpreter, line 244, in interpret
  Module TAL.TALInterpreter, line 682, in do_defineMacro
  Module TAL.TALInterpreter, line 244, in interpret
  Module TAL.TALInterpreter, line 414, in do_optTag_tal
  Module TAL.TALInterpreter, line 399, in do_optTag
  Module TAL.TALInterpreter, line 394, in no_tag
  Module TAL.TALInterpreter, line 244, in interpret
  Module TAL.TALInterpreter, line 592, in do_insertStructure_tal
  Module Products.PageTemplates.TALES, line 217, in evaluate
   - URL: /Test/adr-Formulator/form_zpt
   - Line 11, Column 6
   - Expression: <PythonExpr FormItem.render(ItemValue)>
   - Names:
      {'container': <Folder instance at 9217e80>,
       'default': <Products.PageTemplates.TALES.Default instance at 0x86c364c>,
       'here': <Folder instance at 9217e80>,
       'loop': <SafeMapping instance at 917b478>,
       'modules': <Products.PageTemplates.ZRPythonExpr._SecureModuleImporter instance at 0x86bf3e4>,
       'nothing': None,
       'options': {'args': ()},
       'repeat': <SafeMapping instance at 917b478>,
       'request': <HTTPRequest, URL=http://wr-linux02.rki.ivbb.bund.de:9673/Test/adr-Formulator/search.html>,
       'root': <Application instance at 91e26b8>,
       'template': <ZopePageTemplate at /Test/adr-Formulator/search.html>,
       'traverse_subpath': [],
       'user': tillea}
  Module Products.PageTemplates.ZRPythonExpr, line 48, in __call__
   - __traceback_info__: FormItem.render(ItemValue)
  Module Python expression "FormItem.render(ItemValue)", line 2, in f
NameError: global name 'FormItem' is not defined

Thanks for the help anyway

         Andreas.



More information about the Zope mailing list