Re: howto access the metadata of an index doc
Guido Wesdorp <[email protected]>
| Newsgroups | gmane.comp.web.zope.silva.devel |
|---|---|
| Message-ID | <[email protected]> |
Joachim Schmitz wrote:
> this fails cause the model is the publication not the index.pt, the
> publication has no metadata set "zwec". If I write:
> tal:attributes="colspan python:
> model.index.get_metadata_element('zwec','grid_width')"
>
> it works for index, but not for all other docs.
>
> So the question is how do I get the actuall published document in this
> case ?
>
Not entirely sure, not tested either, but I think what you want is
something like 'doc python:test(hasattr(model.aq_inner, 'get_default'),
model.get_default(), model)' so that if the model is a Folder or
Publication the doc variable will refer to it's 'default document' and
if it's a document the doc var will refer to itself. Note that of course
you will have to check whether the doc is actually a document object
afterwards (can be None if a Publication or Folder has no default
document) and whether it has a published version (something like
doc.get_viewable(), returns either the public version or None).
Cheers,
Guido