[Zope] ZClass container acquisition
Kapil Thangavelu
k_vertigo@yahoo.com
Tue, 25 Apr 2000 00:37:55 -0400
"John D. Rowell" wrote:
<snip>
> Thanks Kapil, I'll try that. BTW, is there any way to modify the class
> to add another base class without starting from scratch?
i feel bad for posting this, and i can't even say if it will work, and
it might hose your ZODB, and curdle your milk, and lots of other
unspeakable nasties, in other words use at your own risk and beware.
http://www.zope.org/Members/AlexR/ChangingBaseClasses
> Also, I'm having problems with acquisition that may be related to forcing
> the client when rendering ZClasses:
>
> - ZBox is a ZClass that renders fancy boxes
> - standard_html_header in the root folder uses ZBox (using the
> <dtml-var "zclass.method(zclass, _)"> syntax)
> - ZLeaf is a folder-aware DTML Document that creates links to
> other documents in that folder as part of a toolbar. It uses
> the standard_html_header in that folder, which calls the root
> standard_html_header (thru PARENT)
yikes, nested/looping acquisition contexts are a mess. folder-aware
document?
> When I render my ZLeaf, I get a ErrorValue: __call__ error in the ZBox
> class (instance). All of the index_html is rendered ok, only the ZBox
> bombs. The, even weirder:
>
> - index_html on root (calling the ZBox)
> - folder f (no index_html)
>
> Trying to access the URL "http://server/f" gives exactly the same error.
> This looks like if I acquire a DTML Document that contains a ZClass, it
> will fail, while calling that document directly succeeds.
Dtml Document containing a ZClass??.. maybe the other way around.
> The dump:
>
> --------
>
> Error Type: AttributeError
> Error Value: __call__
>
> Traceback (innermost last):
> File /home/jdrowell/Zope-2.1.6-src/lib/python/ZPublisher/Publish.py,
> line 214, in publish_module
> File /home/jdrowell/Zope-2.1.6-src/lib/python/ZPublisher/Publish.py,
> line 179, in publish
> File /home/jdrowell/Zope-2.1.6-src/lib/python/Zope/__init__.py, line
> 202, in zpublisher_exception_hook
> (Object: ElementWithAttributes)
> File /home/jdrowell/Zope-2.1.6-src/lib/python/ZPublisher/Publish.py,
> line 165, in publish
> File /home/jdrowell/Zope-2.1.6-src/lib/python/ZPublisher/mapply.py,
> line 160, in mapply
> (Object: index_html)
> File /home/jdrowell/Zope-2.1.6-src/lib/python/ZPublisher/Publish.py,
> line 102, in call_object
> (Object: index_html)
> File /home/jdrowell/Zope-2.1.6-src/lib/python/OFS/DTMLDocument.py,
> line 166, in __call__
> (Object: index_html)
> File
> /home/jdrowell/Zope-2.1.6-src/lib/python/DocumentTemplate/DT_String.py,
> line 502, in __call__
> (Object: index_html)
> File
> /home/jdrowell/Zope-2.1.6-src/lib/python/DocumentTemplate/DT_Util.py,
> line 335, in eval
> (Object: box_search.index_html(box_search, _))
> (Info: box_search)
> File <string>, line 0, in ?
> File /home/jdrowell/Zope-2.1.6-src/lib/python/OFS/DTMLMethod.py, line
> 150, in __call__
> (Object: index_html)
> File
> /home/jdrowell/Zope-2.1.6-src/lib/python/DocumentTemplate/DT_String.py,
> line 502, in __call__
> (Object: index_html)
> AttributeError: (see above)
>
> ------
>
> I'm using workarounds to handle this problem, but would much rather use
> a straight approach. Any hints?
>
> Thanks,
> jdrowell
hmmm... i'm not sure if i want to try and debug this, mainly because i
would have done things a bit differently and i don't have the code to
play with.
what i would try:
first make Zleaf a method, this is the clasic def. of a method, since
its acting on its container. if its just looking for documents to link
it could be as simple as.
<table><tr>
<dtml-in "objectItems(['DTML Document'])">
<dtml-with sequence-item>
<td><a href="<dtml-var absolute_url>"><dtml-var title_or_id></a></td>
</dtml-with>
</dtml-in>
<tr></table>
you can call this method somewhere in your root index_html wherever you
want the toolbar like this
<dtml-var "FolderContainingMethodAccesibleFrom Root.ZLeaf(_.None, _)">
if you feel like debuggin your current situation this line looks
suspicious
> /home/jdrowell/Zope-2.1.6-src/lib/python/DocumentTemplate/DT_Util.py,
> line 335, in eval
> (Object: box_search.index_html(box_search, _))
> (Info: box_search)
at this point i think the error has already occured. although, i don't
think you need to pass a client folder to index_html since your giving
it one already by using the box_search. notation. hmm.. maybe try and
take out the nested standard_html_headers. i'm out of ideas.
regarding zboxes and jdfetch:
you might want to check out RSSChannel, instead of having an external
perl script, plus it gives you Catalog indexin of the headlines.
www.moreover.com , and www.headlinewatch.com have thousands of RSS/XML
feeds/
i'll be working on something similiar for a community portal in the near
future.
I hope that helps,
Kapil
www.sin.wm.edu