"Michael R. Bernstein" wrote:
Ok, so what's next? Somehow, ArchiveImages must be made aware of what Renderings they have.
The ArchiveImage Specialist needs a getRenderingIds() Python Script, which in turn calls container.Renderings.getRenderingIdsFor().
Now I'm stuck. How do I select all the Renderings that have (for example) '001' in their id, and return just the second portion of the id (such as 'original' or 'thumbnail')? What do I need to put into the getRenderingIds and getRenderingIdsFor Python Scripts?
After some head scratching and some advice, I decided to use a ZCatalog in the Renderings Specialist. First I added a SkinScript with the following body: WHEN OBJECT ADDED CALL Catalog.catalog_object(self, _.string.join(self.getPhysicalPath(),'/')) WHEN OBJECT DELETED CALL Catalog.uncatalog_object(_.string.join(self.getPhysicalPath(),'/')) WHEN OBJECT CHANGED CALL Catalog.uncatalog_object(_.string.join(self.getPhysicalPath(),'/')), Catalog.catalog_object(self, _.string.join(self.getPhysicalPath(),'/')) WITH SELF COMPUTE external_id = _.string.split(id,'_')[1], associated_image = _.string.split(id,'_')[0] This ensures hat the objects will be catalogued when they need to be, as well as establishing two computed attributes, 'external_id' and 'associated_image'. I added both properties to the ZCatalog as FieldIndexes, and removed all of the existing indexes except for id. I also added 'external_id' as a meta-data field. Now the Renderings.getRenderingIdsFor Python Script takes an associated_image_id as a parameter, and reads as follows: list = [] list = container.Catalog({'associated_image':associated_image_id}) list2= [] for x in list: list2.append(x.external_id) return list2 And the main ArchiveImages Specialist has a getRenderingIds Python Script: archive_image_id = context.id list = container.Renderings.getRenderingIdsFor(archive_image_id) return list Finally, I added the following to the index_html for the ArchiveImages: <dtml-in getRenderingIds> <a href="<dtml-var sequence-item>"><dtml-var sequence-item></a> </dtml-in> So ArchiveImages now display links to their associated Renderings. Any comments or suggestions for improvements gladly accepted. Michael Bernstein.