[Zope] Probably simple problem...

Thierry FLORAC tflorac@onf.fr
Wed, 26 Sep 2001 17:49:33 +0200


Well... Finally, I think it works !!

What I've done is, in my /dsi/content_html method :

  <dtml-with news>
    <dtml-var content_html>
  </dtml-with>

And it seems to work fine ;-))
Any objection ??

Thierry


On 26.09.2001  -  17:02 Thierry FLORAC wrote:
> Hi...
> 
> Well, effectively, that will probably work fine.
> But my problem is that I may have several folders like "/dsi" (or even
> subfolders of /dsi), each of them requiring use of the /news folder
> methods
> (/news is a folder handling every methods relatives to news, and so each
> folder can use these methods to display and handle several news relatives
> to each subject).
> So, I ABSOLUTELY don't want to duplicate my news handling methods in
> every
> folder that have to display news...!!
> 
> Any idea ?? Is there any way to say in the /news/content_html method : I
> want to call the "get_last_news" object which is in "my" folder, and not
> anywhere else, without worrying of the place from which this method was
> called ??
> 
> Thierry
> 
> On 26.09.2001  -  16:42 complaw@hal-pc.org wrote:
> > This is a simplistic answer (but it will work in your current
> situation).
> > 
> > Simply place get_last_news object in the folder that contains the /dsi
> > and /news
> > folders (i.e., the parent folder of both folders).  That way, both
> > folders can
> > access the same SQL method in the same manner (<dtml-in get_last_news>)
> > in both
> > sub-folders.  Look for the documentation on "acquisitition" in Zope.
> > 
> > Have fun,
> > 
> > Ron
> > 
> > 
> > Try...
> > 
> > <A HREF="../news/get_last_news"></A>
> > 
> > > 
> > > Hi,
> > > 
> > > another little problem I encounter while discovering Zope.
> > > I want to have such folders and objects :
> > > 
> > >   /dsi
> > >     content_html (DTML Method)
> > >   /news
> > >     content_html (DTML Method)
> > >     get_last_news (Z SQL Method)
> > > 
> > > The "/news/content_html" method is using the "get_last_news" SQL
> > method, in
> > > a <dtml-in get_last_news>...</dtml-in> loop.
> > > In the "/dsi/content_html", I want to include the result of the
> > > "/news/content_html" method, so I placed <dtml-var
> > > expr="news.content_html()"> in this script but when trying to view
> the
> > > result, I get a KeyError on "get_last_news", with the following
> > traceback :
> > > 
> > > Traceback (innermost last):
> > >   File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 223, in
> > > publish_module
> > >   File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 187, in
> > publish
> > >   File /usr/lib/zope/lib/python/Zope/__init__.py, line 221, in
> > > zpublisher_exception_hook
> > >     (Object: Traversable)
> > >   File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 171, in
> > publish
> > >   File /usr/lib/zope/lib/python/ZPublisher/mapply.py, line 160, in
> > mapply
> > >     (Object: content_html)
> > >   File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 112, in
> > > call_object
> > >     (Object: content_html)
> > >   File /usr/lib/zope/lib/python/OFS/DTMLMethod.py, line 189, in
> > __call__
> > >     (Object: content_html)
> > >   File /usr/lib/zope/lib/python/DocumentTemplate/DT_String.py, line
> > 549, in
> > > __call__
> > >     (Object: content_html)
> > >   File /usr/lib/zope/lib/python/DocumentTemplate/DT_Util.py, line
> 339,
> > in
> > > eval
> > >     (Object: news.content_html())
> > >     (Info: news)
> > >   File <string>, line 0, in ?
> > >   File /usr/lib/zope/lib/python/OFS/DTMLMethod.py, line 182, in
> > __call__
> > >     (Object: content_html)
> > >   File /usr/lib/zope/lib/python/DocumentTemplate/DT_String.py, line
> > 549, in
> > > __call__
> > >     (Object: content_html)
> > >   File /usr/lib/zope/lib/python/DocumentTemplate/DT_In.py, line 652,
> in
> > > renderwob
> > >     (Object: get_last_news)
> > > 
> > > Where did I made any mistake ??
> > > What's the right way to use scripts and methods in such a (probably
> > basic
> > > !) way...??
> > > 
> > > Thank you for any help.
> > > Thierry
> > > 
> > > _______________________________________________
> > > Zope maillist  -  Zope@zope.org
> > > http://lists.zope.org/mailman/listinfo/zope
> > > **   No cross posts or HTML encoding!  **
> > > (Related lists - 
> > >  http://lists.zope.org/mailman/listinfo/zope-announce
> > >  http://lists.zope.org/mailman/listinfo/zope-dev )
> > > 
> > 
> > 
> > 
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>