[Silva-general] Inline news viewer
Andy Altepeter
aaltepet at bethel.edu
Mon Mar 12 12:55:05 CET 2007
Hi David,
On Monday 12 March 2007 06:45, David Gillies wrote:
> Andy,
>
> I did try that and it came up:
> exceptions.AttributeError - NewsItemReference instance has no attribute
> 'aq_parent'
>
> Any ideas?
The 'NewsItemReference' class is defined in SilvaNews.adapters.newsprivoder.
It looks like a simple wrapper around a news item. It does not provide a
helper method to get the actual item. You could easily add one
(def get_wrapped_item(self): return self._item)
Or, you'll need to use an ExternalMethod that, given a NewsItemReference item,
returns item._item.
I might file a bug for this, as you should be able to get the wrapped item
within protected code.
Cheers,
Andy
>
> david
>
> > Hi David,
> >
> > You can use the zope acquisition api to get the parent of the News
> > Article Version, which is always the News Article, so:
> >
> > item/aq_parent/id
> >
> > Cheers,
> > Andy
> >
> > On Monday 12 March 2007 06:32, David Gillies wrote:
> >> Hi all,
> >>
> >> In the inline news viewer (see below) I would like to get the News
> >> Article 's id. At the moment the item id is that of the latest version.
> >> How can I get at the artcile's actual id?
> >>
> >> <tal:block tal:condition="python:len(items) > 0">
> >> <div class="news-item" tal:repeat="item items">
> >> <p tal:replace="item/title" />
> >> <tal:block tal:define="title item/title">
> >> <h3 tal:content="structure title"
> >> tal:condition="python:options['show_link_article'] ==
> >> 'separate'">
> >> title
> >> </h3>
> >> <h3 tal:condition="python:options['show_link_article'] !=
> >> 'separate'">
> >> <a tal:attributes="href item/link"
> >> tal:content="structure title">
> >> title
> >> </a>
> >> </h3>
> >> </tal:block>
> >>
> >> David
> >>
> >>
> >> --
> >> David Gillies
> >> Web Support Officer
> >> Web Services
> >> EISD
> >>
> >> ext: 45786
> >>
> >>
> >>
> >> _______________________________________________
> >> Silva-general mailing list
> >> Silva-general at infrae.com
> >> https://infrae.com/mailman/listinfo/silva-general
>
> --
> David Gillies
> Web Support Officer
> Web Services
> EISD
>
> ext: 45786
More information about the Silva-general
mailing list