[Zope] Accessing attributes - object with 'implicit' period in id

John Schinnerer johnschinnerer@yahoo.com
Fri, 31 May 2002 22:14:22 -0700 (PDT)


Howdy,

--- Casey Duncan <casey@zope.com> wrote:
> thumbURL is just a string that contains the path to the image
> correct? I'm 
> assuming that thumbURL is a metadata element from you ZCatalog right?

That's correct.  
I'm not real clear on how metadata stuff works yet, but I kinda get
what you're suggesting, and I'll try it...I may also end up redesigning
the whole bizness to avoid a traversal...

thx,
John S. 

> I suggest 
> that you do it exactly once when the object is cataloged and store
> the generated image tag as catalog metadata.
> 
> In order to do this, write a short Python script called something
> like "thumbTag" with this code in it:
> 
> thumb = container.restrictedTraverse(context.thumbURL)
> return thumb.tag(alt=context.caption)
> 
> Put this Python script somewhere where it can be acquired by the
> Catalog and 
> all the image objects. Inside the ZCatalog will also work. Now add a
> metadata 
> element to the ZCatalog with the same name as the Python script
> (thumbTag). 
> Update your catalog to fill in the metadata. Go to the catalog tab
> and see if 
> the thumbTag values got filled in (they should contain image tags)
> 
> Your DTML can now be:
> 
> <a href="&dtml-imageURL;"><dtml-var thumbTag></a>
> 
> hth,
> 
> Casey


__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com