RE: [Zope-dev] Calling rendered objects from a product
More than one way to skin that particular cat I'll warrant. here's one cut from a heavily used external method to render a zope dynamic page to a disk file. import Globals ... o = getattr(self,thingtorender) rendered_doc = o(client=o,REQUEST=REQUEST,globals=globals()) ... Incidentally, why bother making a cache inside of zope? There are perfectly good ones already available out there like squid. Wouldn't it be easier to just dump the result from every query you encounter into a disk file. Serve with apache but run a squid cache front end to zope. This would be relatively easy to develop and could probably run very fast. Refresh the static files as often as needed. How often do things change in the data? If slowly, hourly re-rendering of queries as they arrive might work ok. Given that there are tools to do this, it just might be easier with static html than with live zope.... Carlos Neves wrote
I need to call a rendered url, passed the REQUEST and wanted to do it directly to the self var. Not being able to do it, I have come with the solution of calling urllib with URL1, the called object and '?' + the query string... Not that fancy, but it works... slowly but smoothly.
On Thu, 15 Jun 2000, Dr. Ross Lazarus wrote:
import Globals ... o = getattr(self,thingtorender) rendered_doc = o(client=o,REQUEST=REQUEST,globals=globals()) ...
A 'call of nonfunction' type error, as far as thing to render is index_html (DTMLMethod). Anyway, I have tryied to do it in a whole lot of ways, when all I want to do is to copy the behavier of <dtml-var "_.getitem(thing,1)">. Shouldn't be too hard, I thought. But I have no access to that function. Calling self.thing returns None, calling self.aq_parent.thing returns an html_quoted version of the doument_src. The real problem, come to think of it, is that if I call self.aq_parent.thing.__call__() I get the thing, but with a key error for the standard_html_header. So, I don't have access to the namespace? or the aquisition engine doesn't work this way?
Incidentally, why bother making a cache inside of zope? There are perfectly good ones already available out there like squid. Wouldn't it be easier to just dump the result from every query you encounter into a disk file.
It's just too dinamic...I mean, we have an index_html on the root wich serves everything and everyone. Then we have thematic areas with top and bottom bars wich differ from each other, than there's the real info being queried wich appears in the middle "frame", but all this without frames, with only a base table structure on the root index_html. Btw, data can change very rapidly, and so the cache was not to avoid charging zope with the request load, but to avoid having to process the pages, wich are rather complicated, everytime it gets requested. And we are getting 1000+ hits per minute, so a one minute cache with a pre-rendered page for us would do fine. We try to avoid external help on this.
Given that there are tools to do this, it just might be easier with static html than with live zope....
We all had experience in developing with Apache/Perl or Apache/PHP3 and ok, it works, it's fast and all that. But seriously, developing a portal without zope just seems impossible now, knowing that what took me 1-2 weeks to develope before can now be done in a days work, and all without mixing functional code and aspect. Wow, we can even undo! Can't beat this, I'm afraid. :) -- Carlos Neves cneves@ruido-visual.pt
On Thu, 15 Jun 2000, Carlos Neves wrote:
real problem, come to think of it, is that if I call self.aq_parent.thing.__call__() I get the thing, but with a key error for the standard_html_header. So, I don't have access to the namespace? or the aquisition engine doesn't work this way?
I think dtml methods expect to receive a client as the first (non-self) arg and the namespace as the second. But that raises the question of where you get the namespace from in a python method so you can pass it... --RDM
participants (3)
-
Carlos Neves -
Dr. Ross Lazarus -
R. David Murray