[Zope] 2.3.2b1 bug? objectIds shows items, but hasattr doesn't, what gives?

Brad Clements bkc@murkworks.com
Thu, 26 Apr 2001 14:45:34 -0400


I have a strange situation with Zope 2.3.2b1 

I'm using Interbase to store information about manufacturers, products groups, 
products, product variations.. Each of these record types have a primary key (id), which 
is used to reference .jpg images in ZODB.

For example, manufacturer One on 1 Design has a T-Shirt Group with 3 products.

These product images would be stored in folders named as

Images.one.oneclt.one101clt,  Images.one.oneclt.one102clt and 
Images.one.oneclt.one103clt

where "one" is the manufacturer id, "oneclt" is the product group id, and "one101clt" 
(etc) is the product id.

This has been working well at http://www.adirondackcraft.com

We recently moved to 2.3.2b1, and added some images. We have a dtml-method that 
walks the database looking for missing images. 

What's happening is that hasattr is not finding some of the Product folders, even though 
zope shows that they are there in the manage screen, objectIds shows them too.

--

here's an example output of the report:

Checking Group oneclt
Contents of http://www.adirondackcraft.com/Holmes/Images/one/oneclt
Object one101clt at 
Object one102clt at 
Object one103clt at 

Checking Product "Canoe" design T-shirt (Images.one.oneclt.one101clt)
Call Found It 
Checking Product "Sit Back & Relax" design T-shirt (Images.one.oneclt.one103clt )
Call Failed 
Product Folder Images.one.oneclt.one103clt MISSING

Checking Product "Trees" design T-shirt (Images.one.oneclt.one102clt )
Call Failed 
Product Folder Images.one.oneclt.one102clt MISSING


Note that the objects one102clt, one103clt are shown in the objectlist, but hasattr fails 
to find these two folders (yet the one101clt folder is found).

I've tried two tests, one by dtml-call on the object's id in a try statement, and the other 
with hasattr. Both fail the same.

Also note that the object list shows blank space after "at", what's supposed to be here is 
the absolute_url of the folder. It's coming bank blank, but works on the parent folder.

Here's the dtml-method that produces the report (just a scrap of it)

-- snip --

Contents of <dtml-var "Images[manufacturerid][groupid].absolute_url()"><br> 
<dtml-in "Images[manufacturerid][groupid].objectIds()">
Object &dtml-sequence-item; at <dtml-call "Images[manufacturerid][groupid][_['sequence-item']].absolute_url()"><br>
</dtml-in>
<dtml-in "SQL_Products(groupid=groupid)">
<li><h5>Checking Product &dtml-title; (Images.&dtml-manufacturerid;.&dtml-groupid;.&dtml-id;)</h5>
<dtml-try>
<dtml-call "Images[manufacturerid][groupid][id].id">
Call Found It
<dtml-except KeyError>
Call Failed
</dtml-try>
<dtml-if "not _.hasattr(Images[manufacturerid][groupid],id)">
<div style="color:#ff0000">Product Folder Images.&dtml-manufacturerid;.&dtml-groupid;.&dtml-id; MISSING</div><br>
<dtml-else>
 snip snip.

---

I also tried objectItems and objectValues rather than objectIds, but the returned objects 
still return blank for absolute_url()

I've packed the database and restarted the server, still no worky.



Brad Clements,                bkc@murkworks.com   (315)268-1000
http://www.murkworks.com                          (315)268-9812 Fax
netmeeting: ils://ils.murkworks.com               AOL-IM: BKClements