[Zope-CMF] Re: [dev] OrderSupport and Skin changes

yuppie y.2004_ at wcm-solutions.de
Tue Jun 1 03:44:30 EDT 2004


Tres Seaver wrote:
> yuppie wrote:
>> Tres Seaver wrote:
>>
>>>> 2) fall back to the Zope 2.7.0 API in the skin methods if the 
>>>> 'subset_ids' argument is not available
>>>
>>> How will you detect that?  Via a TypeError exceptoin handler?
>>
>> Yes. Something wrong with that?
> 
> It feels inelegant, but may be the best workaround.

Well. I guess a cleaner approach would be to use isImplementedBy / 
providedBy. But that would mean that we have to add a new interface for 
each API change. I doubt that's the Right Thing.

Maybe the Interface package should support version numbers, e.g.:


<interfaces zope="2.7.0">
     class IOrderedContainer(Interface):
         __compatible__ = '1.0'

         def moveObjectsUp(ids, delta=1):
             ...
</interfaces>

<interfaces zope="2.7.1">
     class IOrderedContainer(Interface):
         __compatible__ = '1.0', '1.1'

         def moveObjectsUp(ids, delta=1, subset_ids=None):
             ...
</interfaces>

<usage>
     if IOrderedContainer.versionProvidedBy('1.1', context):
         attempt = context.moveObjectsUp(ids, delta, subset_ids)
     else:
         attempt = context.moveObjectsUp(ids, delta)
</usage>


Cheers, Yuppie






More information about the Zope-CMF mailing list