[Zope] Struggle to call a Zclass object from another web object
pieter claassen
pieter@openauth.co.uk
13 Mar 2003 16:43:56 +0000
Ok, point taken, but...
The folder that I placed my product (remember we are talking ZClass
product here) in does have a standard_html_header and footer. So this
looks like some kind of bug and the object traversal is not working. All
I want to do is include the result of the __call__ in a html page so
that I can __call__ a number of objects (just by including them as
<dtml-var>) and return their results in one page.
This works fine for any native zope object (folder, file etc.) but for
my custom Zclass based product, it fails.
Another pointer is that when I do this
<dtml-var newster>
I get the following rendition in my web page
<NewsManager at newster>
I have worked around the problem by calling the Object URL in an inline
frame, but that is a little lame.
Here is my ZClass's index_html
<dtml-in "objectValues('Message')">
<dtml-unless expire>
<table width="606" border="1" cellspacing="2">
<tr><td>
<h1><dtml-var title></h1>
</td></tr>
<tr><td>
<h2><dtml-var summary></h2>
</td></tr>
<tr><td>
<p><dtml-var body>
</td></tr>
</table>
</dtml-unless>
</dtml-in>
And this is the error that I get when I call it as follows:
<dtml-with newster>
<dtml-var expr="newster.index_html()">
</dtml-with>
Error traceback
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 OFS.DTMLMethod, line 126, in __call__
Module DocumentTemplate.DT_String, line 474, in __call__
Module DocumentTemplate.DT_With, line 76, in render
Module DocumentTemplate.DT_Util, line 201, in eval
- __traceback_info__: newster
Module <string>, line 2, in f
Module OFS.DTMLMethod, line 119, in __call__
Module DocumentTemplate.DT_String, line 474, in __call__
Module DocumentTemplate.DT_In, line 628, in renderwob
Module DocumentTemplate.DT_Util, line 201, in eval
- __traceback_info__: objectValues
Module <string>, line 2, in f
NameError: global name 'objectValues' is not defined
Thanks,
Pieter
On Thu, 2003-03-13 at 15:18, Dylan Reinhardt wrote:
> The problem is you're having is not the problem you think you're having. :-)
>
> You're getting an error for standard_html_header. Zope hasn't gotten to
> parse the expression you're fiddling with yet, so don't be surprised if
> what you're doing continues to produce errors.
>
> Tracebacks are a very good thing to get in the habit of reading. Typically
> the most important information is contained in the last couple steps,
> though in Zope, it's sometimes the case that the real error is five or six
> steps in.
>
> In this case your error is right on the last line:
> Module DocumentTemplate.DT_String, line 474, in __call__ KeyError:
> standard_html_header
>
> When objects get rendered, the __call__ method is typically used on
> them. Everything to the left of that is unlikely to be useful to you until
> you get to the point where you're modifying source code. Looking to the
> right of __call__, a KeyError usually pops up when an object name can not
> be resolved by Zope. This error is telling you that Zope was unable to
> find the standard_html_header object.
>
> So make sure there is a standard_html_header in your root folder that you
> have permissions to view it. That should fix the problem... or at least,
> it will get you along to the next one. :-)
>
> HTH,
>
> Dylan
>
>
> At 02:09 AM 3/13/2003, pieter claassen wrote:
> >Hello,
> >
> >
> >I guess I still don't get Zope completely.
> >
> >I wrote a news manager Zclass that works well. Normally I get to the
> >object by calling the newster/index_html method (the default behaviour).
> >
> >I want to integrate it into my website and in my root directory I have
> >the following objects:
> >
> >index_html (dhtml object)
> >menu (dhtml object)
> >top (dhtml object)
> >news (Zclass object)
> >
> >I want to do use my index_html to do pull all these objects together on
> >a single page like:
> >
> ><dtml-var standard_html_header>
> ><dtml-var top>
> ><table border="0" cellspacing="0" cellpadding="0">
> ><tr>
> ><td>
> ><dtml-var menu>
> ></td>
> ><td><dtml-var news></td>
> ></tr>
> ></table>
> ><dtml-var standard_html_footer>
> >
> >But, clearly calling <dtml-vat news> just doesn't call the index_html
> >method on the news object and include the result.
> >
> >I have tried things like <dtml-var expr="news.index_html()"> and that
> >get an error that
> >
> >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 OFS.DTMLMethod, line 126, in __call__
> > * Module DocumentTemplate.DT_String, line 474, in __call__
> > * Module DocumentTemplate.DT_Util, line 201, in eval
> > __traceback_info__: newster
> > * Module <string>, line 2, in f
> > * Module OFS.DTMLMethod, line 119, in __call__
> > * Module DocumentTemplate.DT_String, line 474, in __call__
> >KeyError: standard_html_header
> >
> >Somebody out there must have solved this problem? Any help is
> >appreciated.
> >
> >Thanks,
> >Pieter
> >
> >
> >_______________________________________________
> >Zope maillist - Zope@zope.org
> >http://mail.zope.org/mailman/listinfo/zope
> >** No cross posts or HTML encoding! **
> >(Related lists -
> > http://mail.zope.org/mailman/listinfo/zope-announce
> > http://mail.zope.org/mailman/listinfo/zope-dev )
--
-----------------------------
Pieter Claassen
pieter@openauth.co.uk
http://www.openauth.co.uk
OpenAuth
Tel: 01344 390530
DDI: 01344 390630/390631
Fax number: 01344 390700
Mobile: 0776 665 6924
Highview House
Charles Square
Bracknell
Berkshire
RG12 1DF
TERMS AND CONDITIONS
(i)The information contained in this email and attachments is only
intended for the addressed recipient(s) and may not be distributed or
viewed by any other party without the explicit consent of the sender. If
you have received this message by accident, please contact Pieter
Claassen (pieter@openauth.co.uk) and destroy any electronic or physical
copies of the information contained in it, immediately.
(ii)This email is not certified to be virus free and OpenAuth accepts no
liability for losses arising from you receiving this email.
(iii)Any digital signatures (if present) used to authenticate this
email, only serves to allow you to verify the originating email address
of the sender and should not be relied upon to prove identity or base
financial transactions on, unless the Certificate Practice Statement
that the signature references, explicitly states differently.
(iv)This email may be subjected to further terms and conditions as
published on the company website at http://www.openauth.co.uk. If you
need to rely on the information contained in this email in any way, then
you should read those terms and conditions to understand how much you
can trust the information in this email.
(v)OpenAuth retains the copyright on any relevant material that is
included in this email.