[Zope-dev] Re: [ZPatterns] HowTo: Make an Image/File a DataSkin ???

Phillip J. Eby pje@telecommunity.com
Wed, 11 Jul 2001 06:41:24 -0500


At 08:03 AM 7/11/01 +0100, Steve Alexander wrote:
>Steve Spicklemire wrote:
>
>>Hi Ulrich,
>>         Hmm.. can you just call DataSkin.__init__(self, id) in the 
>> File's constructor?
>
>
>You might need to do it like this:
>
>   DataSkin.inheritedAttribute('__init__')(self, id)

Actually, I'm not sure you need to do anything special at all.  If you use 
the File DataSkin in a Folder w/Customizer Support, you shouldn't need to 
do anything special, because in that mode the 'id' attribute is never used 
by ZPatterns.  If you need to use these File DataSkins in a Rack, though, 
you'll need to include a SkinScript that says::

  WITH SELF COMPUTE id=getId()

Racks still use the "id" attribute directly, I'm afraid.  Your '__init__' 
method will still need to accept an 'id' parameter, also, and you'd need to 
set the __name__ attribute instead of id.  Ugh.

Anyway, I will take a look at Rack and see if it can be made to use the 
'getId()' and 'setId()' methods.  Of course, you can also subclass Rack and 
replace the '_getClientID(client)' method with one that uses 'getId()', but 
it might be that I could do this safely in the base Rack class.

The SkinScript examples should also probably be changed to use 'getId()' 
instead of 'id' so that people don't use them as a justification for 
continuing to indulge in deprecated behavior.  :)