[ZPatterns] Rack.getItem returning attributeless objects (ZPatterns newbie)

Phillip J. Eby [email protected]
Fri, 06 Jul 2001 14:27:02 -0400


Sounds like something in the acquisition path (either the Specialist or one 
of its parents) has a 'name' attribute.

At 01:02 PM 7/6/01 +1000, Phillip Crumpler wrote:
>I tried what you suggested - still no banana :-(  So, I tried an example so
>simple even I would have trouble getting it wrong.
>
>The rack has a single SQL query, SQL_get:
>   SELECT name FROM dskins WHERE dskin_id=<dtml-sqlvar dskin_id type="int">
>The table has two columns, dskin_id int and name text.
>The rack has a single skinscript method, with one line:
>   WITH QUERY SQL_get(dskin_id=self.id) COMPUTE name
>The load attribute of the rack is 'name'. The rack stores a zclass that is
>derived from DataSkin, with an index_html method added, nothing else.
>
>Still, getItem with a non existant dskin_id will return an object. Is this
>suppposed to happen?
>
>SQL_get is being called correctly and returning nil rows. Digging around a
>bit in Racky.py,  the line in Rack.retrieveItem
>         if hasattr(item.aq_base, a):
>succeeds, even though the query returned no rows (a is the loadAttribute of
>the Rack, 'name'). getattr(item.aq_base,a) returns an empty string.