hello there,

in a page template (namely, in a portlet TAL script),
i am trying to create a list of ZOPE objects (from different
folders), sort them and display them in a convenient way.

the portion of the script that creates the list of objects is
here:


<div tal:define="aboutbccn python:getattr(portal, portalitem);
                 announcements python:[];">
    <div tal:repeat="aboutbccnitems python:aboutbccn.contentIds()">
        <div
                tal:condition="python:aboutbccnitems.find('press') == 0 or
aboutbccnitems.find('media') == 0">
        <div
           tal:define="mr python:getattr(aboutbccn, aboutbccnitems)">
              <div tal:repeat="obj python:mr.contentValues()">
                   <!-- HERE IS THE SLOWING PART: -->
                   <p tal:define="a python:announcements.append(obj)"
                      tal:content="python:len(announcements)">
                   </p>
                     ......
// AND SUFFICIENT NUMBER OF </div>s


the "announcements python:[]" part in tal:define tag initializes the
list, and the list becomes populated with the
"a python:announcements.append(obj)" in tal:define tag.

the problem is that the script works really slowly; the page takes at
least a few minutes to respond and display the outcome (i'm sure of
the fact that it is the "a python:announcements.append(obj)" part
that causes the slow-down). the python process on the server uses
%99 percent of the cpu after this script gets displayed on my page
and i have to restart zope to be able to get the webpage work normally
again.

does anyone have an idea why python process goes crazy with this
template? another question is whether there is any problem with using
list of zope objects (i prefer to use lists over dictionaries because i
want to sort them and as far as i know dictionaries are not sortable).

for reference, the system i am using:
zope 2.8.6
python 2.3.5

thank you in advance

_______________________________________________
ZPT mailing list
ZPT@zope.org
http://mail.zope.org/mailman/listinfo/zpt

Reply via email to