[Fwd: Re: [Zope] URGENT : site inaccessible when traffic is high]

Hamzat Kamal k_hamzat@yahoo.com
Tue, 28 May 2002 06:45:38 -0700 (PDT)


Dear chris,

> Hamzat,
> It'd be useful to be able to understand what this DTML is trying to
> do...
> it seems like you're just looping over objects trying to find one
> with a
> particular id.  Is "num" passed in as a form variable
--------
What the DTML does is to loop over the folders and DTML Documents in
each folder, look for DTML Document which its id equal to variable mm
and display part of the doc as well as setting path to the full doc.

No, "num" get it value from a method which has been called above this
extracted code below.

> I also don't see
> how the '<dtml-if "mm==test">' conditional could ever be true.  I'm
> sure
> it works, but I'm not sure how. ;-)
------
yes, you are right but in the actual code that is running the object
id is assign to test rather than the sequence-item as shown in the
code below. What happened was that somebody advise that it is a
serious programming error to have used 2 objectValues in the 2 loops
that I should change the objectValues for the inner loop to
objectIds, that it could be the cause of the problem.

<dtml-in "objectValues(['DTML Document'])">

That was when i have to change the id to sequence-item.

Can you please explain to me the effects of using objectValues and
objectIds? 


> 
> In any case, I think you probably want to use a ZCatalog for this
> kind of
> search.  Brute-force search is a very expensive operation.
> 
> On Mon, 2002-05-27 at 11:50, hamzatk@3dresearch.com wrote:
> > > that is a good example for trying to use DTML where it should
> not be
> > > used  anymore.
> > >
> > > i suggest you move this logic into a more appropriate kind of
> object,
> > > such  as a python script.
> > >
> > > jens
> > >
> > <dtml-in "news.objectValues(['Folder'])">
> > <dtml-let number=sequence-number path=id>
> > <dtml-if expr="number < _.int(num)">
> > <dtml-in "objectValues(['DTML Document'])">
> > <dtml-try>
> > <dtml-call "REQUEST.set('mm',
> > ZopeTime().toZone('GMT+1').strftime('%d%m%y'))">
> > <dtml-let test=sequence-item>
> > <dtml-if expr="mm==test">
> > <font face=arial size=-5>
> > <dtml-var expr="_.getitem(mm,1)[0:400]">....<br>
> > <a href="&dtml-ngrHome;news/&dtml-path;">
> > <img src="images/morex.gif" border="0" width="60" height="23">
> > </a><br>
> > <dtml-if expr="number < _.int(num)-1">
> > <hr size="2" width="75%">
> > </dtml-if>
> > </font>
> > </dtml-if>
> > </dtml-let>
> > <dtml-except>
> > </dtml-try>
> > </dtml-in>
> > </dtml-if>
> > </dtml-let>
> > </dtml-in>


Regards.


=====
Hamzat kamaldeen Ishola
Dnet Systems Limited. 223 Ikorodu Road, Lagos. Nigeria.
234 1 7749381, 234 08033011305
---
Making Mistake is not a problem but readiness to admit it.
Sentimental decisions are not mistakes but failures !!!
Mistake is an opportunity to see better !!!

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com