Re: AttributeError: aq_parent on images in Data table (on ZMS content root object)

Niels Dettenbach <[email protected]> Thu, 22 Dec 2011 15:57:32 +0100
Newsgroups gmane.comp.cms.zms.devel
Organization Syndicat IT&Internet
Message-ID <2326745.580KvsWQh6@gongo>
Am Freitag, 21. Oktober 2011, 15:06:03 schrieben Sie:
> If no one has a similiar problem i assume it is affected by anything within
> my  setup here.
Just in addition:

sorry for coming back with this again, but it seems there still is a small bug in the current tree here. I've further investigated with todays current that my code should be correct, as i still get parameters of the image blob - like i.e.:

	<dtml-var expr="img.getWidth()">
	<dtml-var expr="img.getFilename()">

but if i call a

	<dtml-var expr="img.getFilename(REQUEST)">
	
i still get a 

--- snip ---
in File "/var/zope/abc/Products/zms/_blobfields.py", line 735, in getHref parent = self.aq_parent AttributeError: aq_parent 
--- snap ---

again (as in older versions of 2.13).


Here is the code i use (i have a table of 52 images by kw_id - one image per week of the year) and want to show another image each week of year in this case:

<dtml-let doc="content">
<dtml-let weekofyear="DateTime().week()">
 <dtml-let images="filter_list(doc.bg_images_zms.getObjProperty('records',REQUEST),'kw_id',weekofyear)">
  <dtml-if images>
   <dtml-in images mapping>
    <dtml-let image="formatObjAttrValue(getObjAttr('kw_image'),kw_image, lang)">
     <dtml-call "REQUEST.set('img',image)">
    </dtml-let>
   </dtml-in>
  <dtml-else>
   <dtml-call "REQUEST.set('img',doc.getObjProperty('bg_image_default',REQUEST))">
  </dtml-if>
<dtml-with content>
<dtml-var expr="img.getHref(REQUEST)">
</dtml-with>
</dtml-let>
</dtml-let>
</dtml-let>


May be this is a likely hidden bug as not much users may use table objects on the ZMS object (ZMS root) - we may solve this by workarounds like using 1-n objects instead of a table, but for proper functionality and completeness this should work too i think. 

Unfortunately i can't figure out the problem within the ZMS code byself here and cant build the path byself from other parts (i.e. getFilename()) as i did not have the (changing) path......

May be someone will be faced to the same problem at some time in the future...


best regards,


Niels.
-- 
---
Niels Dettenbach
Syndicat IT&Internet
http://www.syndicat.com/
signature.asc (application/pgp-signature, 836 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (GNU/Linux)

iQIcBAABCAAGBQJO80VkAAoJEM78prARigUnJw0P/11BjLVaFJTWBAcktLP/H7Om
VjADwHfjZCa8rdWp2pTb+jW32xj4zN0wjlj1PUSld8KxsbBeaAcCi8dAsUB389G9
9VDHrLpKPvFrAo3TWgHnOrPs6eSaPVmllyIDsv7Yli3g/wvhoUmr8f8kpl7BQCbg
Q6GIdYVET83h0nyYyPDemGZbhWtnkL9+B6DG5JzOea5O2C3DkyEPlfm47HrtJTmD
rWHNZ680/m4TFRGtH3nR9AFpslR9hsBAK1QxF6mcZIEf2ZfnFHi0Lu34EMbsJTAI
2DGTGrMxVK7EzBWvKQKo/wMq77CahjglZqs8dffa4/w4hm/cKuXbaWrihjfCfavG
0EfxZ13Cg8FmEbOhqcRUy7F9Ag1sOOyFZCQlhlyi5o1324hDtX4d7N6TRhGVYoB7
1+L+093+pMqAhZ+h+9mjloTppThRV4GGpsHh0xb/hBijjHp3Mz0HvAwn5aZjSL2K
8hD6CiFopTqf175Pr+A6hqQbLpMysL/KAOlufwl+n46GrFUzMmubppxDxByqsL9Q
iGi+X10xa2Ghno3ejgcIg/X6qMsKxihOJjEYUIWUaQtkDKmfBr8KLX6WEiR0JAS1
J56l9yEFGw4RvtmQEeh7dsRvStaNoTsUIk5dYbGcCtfVVTYBqfE++jcU8Q+Y7bIk
Y1GglPNA/GMtKzLXNuOM
=BCio
-----END PGP SIGNATURE-----