[Zope3-Users] Access subfolder's files object's metadata thru tal macros

Nicolas Legault nicolas.legault at gmail.com
Tue Apr 25 01:19:04 EDT 2006


I'm trying to list all the "files objects" in a folder with their metadata
descriptions in a ZPT page thru written thru the ZMI.

I'm successfully accessing the metadata description of a single file with:

<p tal:replace="context/a_folder/a_file_in_a_folder/zope:description"></p>

but when I try to iterate all the files I'm stuck with the correct syntax:

<div tal:repeat="item context/a_folder">
  file:<p tal:replace="item">filename</p><BR> <!-- This line work correctly
-->
  desc:<p tal:replace="item/zope:description">description</p><BR> <!-- this
line create a system error -->
</div>

Is there someone who can tell me the correct way to do this ?


 Traceback (innermost last):
  Module zope.publisher.publish, line 138, in publish
    result = publication.callObject(request, object)
  Module zope.app.publication.zopepublication, line 164, in callObject

    return mapply(ob, request.getPositionalArguments(), request)
  Module zope.publisher.publish, line 113, in mapply
    return debug_call(object, args)
   - __traceback_info__: <bound method ZPTPageEval.index
 of <zope.app.publisher.browser.viewmeta.ZPTPageEval object at 0x419cd3ac>>
  Module zope.publisher.publish, line 119, in debug_call
    return object(*args)
  Module zope.app.zptpage.browser.zptpage, line 29, in index

    return template.render(request, **kw)
  Module zope.app.zptpage.zptpage, line 92, in render
    sourceAnnotations=debug_flags.sourceAnnotations)
  Module zope.pagetemplate.pagetemplate, line 117, in pt_render

    strictinsert=0, sourceAnnotations=sourceAnnotations)()
  Module zope.tal.talinterpreter, line 270, in __call__
    self.interpret(self.program)
  Module zope.tal.talinterpreter, line 345, in interpret

    handlers[opcode](self, args)
  Module zope.tal.talinterpreter, line 837, in do_loop_tal
    self.interpret(block)
  Module zope.tal.talinterpreter, line 345, in interpret
    handlers[opcode](self, args)

  Module zope.tal.talinterpreter, line 529, in do_optTag_tal
    self.no_tag(stuff[-2], stuff[-1])
  Module zope.tal.talinterpreter, line 511, in no_tag
    self.interpret(program)
  Module zope.tal.talinterpreter
, line 345, in interpret
    handlers[opcode](self, args)
  Module zope.tal.talinterpreter, line 618, in do_insertText_tal
    text = self.engine.evaluateText(stuff[0])
  Module zope.app.pagetemplate.engine, line 101, in evaluateText

    text = self.evaluate(expr)
  Module zope.tales.tales, line 698, in evaluate
    return expression(self)
   - /LocalWeb/index2.html
   - Line 12, Column 7
   - Expression: <PathExpr standard:u'item/zope:description'>

   - Names:
      {'args': (),
       'container': <zope.app.folder.folder.Folder object at 0x41e54e6c>,
       'context': <zope.app.folder.folder.Folder object at 0x41e54e6c>,
       'default': <object object at 0x4039e488>,

       'loop': {},
       'nothing': None,
       'options': {},
       'repeat': {},
       'request': <zope.publisher.browser.BrowserRequest instance URL=
http://immocontrole.ca:8080/LocalWeb/index2.html>,
       'template': <zope.app.zptpage.zptpage.ZPTPage object at 0x4200b92c>,
       'usage': <zope.pagetemplate.pagetemplate.TemplateUsage object
at 0x41bc298c>}

  Module zope.tales.expressions, line 204, in __call__
    return self._eval(econtext)
  Module zope.tales.expressions, line 191, in _eval
    ob = self._subexprs[-1](econtext)
  Module zope.tales.expressions
, line 123, in _eval
    ob = self._traverser(ob, element, econtext)
  Module zope.app.pagetemplate.engine, line 57, in zopeTraverser
    request=request)
  Module zope.app.traversing.adapters, line 177, in traversePathElement

    return traversable.traverse(nm, further_path)
  Module zope.app.traversing.adapters, line 61, in traverse
    raise TraversalError(subject, name)
   - __traceback_info__: (<zope.app.pagetemplate.talesapi.ZopeTalesAPI
 object at 0x4203a48c>, 'description', [])
TraversalError: (<zope.app.pagetemplate.talesapi.ZopeTalesAPI object
at 0x4203a48c>, 'description')



--
Nicolas Legault
Recherche Et Développement
Immo Contrôle Inc
Tel: 514 272-3453 Ext 2
Fax: 514 272-3453
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope3-users/attachments/20060425/1280b28c/attachment.htm


More information about the Zope3-users mailing list