[Zope-dev] Success! Was: Re: [Zope-dev] How is 'retrieveItem intended to work with TTW Specialists? Specialists?

Steve Spicklemire steve@spvi.com
Wed, 4 Oct 2000 21:15:34 -0500 (EST)


Thanks again... 

I just wanted to report that this worked like a treat! 

The actual syntax I ended up using was:

WITH ProductSpecialist.getItem(self.id) COMPUTE 
theRealThing = (RESULT is _.None) and NOT_FOUND or RESULT

WITH self.theRealThing COMPUTE 
price=RESULT.discountPrice(self.theRealThing), 
name=title, description=shortDescription, available=1

discountPrice is a method of the online catalog's original DataSkin
object, used to compute a percentage discount for 'web delivery'. My
app uses the notion of availablility. There was no such notion in the
catalog dataskins.. so I just set it to be an unconditional 'true'.

This way we didn't even to use property sheets. Basically the
skinscript could map the properties (and methods) that already existed
in the 'online catalog' onto properties of my 'virtual dataskins' so
that my app didn't need to be changed at all.

This was also nice since in my Specialist I could do things
like:

<dtml-call "RESPONSE.redirect(this().theRealThing.absolute_url())">

After the user is finished working in my 'app area' they could
get redirected back to the actual object that my Specialist
was 'posing' for...

thanks!
-steve

>>>>> "Phillip" == Phillip J Eby <pje@telecommunity.com> writes:

    Phillip> WITH otherSpecialist.getItem(self.id) COMPUTE
    Phillip> theRealThing = (RESULT is None) and NOT_FOUND or RESULT

    Phillip> WITH self.theRealThing COMPUTE myAttr1 =
    Phillip> RESULT.theirAttr1, myAttr2 = theirAttr2, # equivalent to
    Phillip> myAttr2 = RESULT.theirAttr2 SomeAttr, # equivalent to
    Phillip> SomeAttr = RESULT.SomeAttr myAttr5 = theirAttr1 *
    Phillip> theirAttr6