[Zope-dev] Re: View component registration
Jim Fulton
jim at zope.com
Thu Jun 19 09:46:35 EDT 2008
On Jun 19, 2008, at 9:37 AM, Philipp von Weitershausen wrote:
> David Glick wrote:
>> On Jun 18, 2008, at 1:44 PM, Malthe Borch wrote:
>>> Martijn Faassen wrote:
>>>> There's one major problem that I see. What's the backwards
>>>> compatibility story? I'm sure there are a lot of cases in lots of
>>>> code where people look up views with a getMultiAdapter, and if we
>>>> started registering views differently, wouldn't that code break?
>>>> How to we get from A to B?
>>>
>>> It deserves consideration, but I don't think code will be prone to
>>> break since we're merely providing more information to lookup a
>>> view component, not less.
>> Exactly. The interface passed to getMultiAdapter or
>> queryMultiAdapter is a minimum requirement. Making views provide
>> IView won't stop them from providing Interface, which is the default.
>
> Well, true, view *lookup* for Interface will still work if we
> register views for a more specific interface. But if Zope's browser
> publication now starts looking up views with the more specific
> interface and there are still views around that haven't been
> registered for that but for Interface, we'll run into backward
> compatibility problems.
>
> I suppose the browser publication would have to be smart about it
> and do a legacy lookup for Interface if it can't find a view for the
> specific one.
>
> Either way, it's not *that* simple...
I suggest:
- decide on and advertise the new interface
- continue to do look ups the way we do now
- update relevant zcml directives (view, page, resource. etc.) to use
the new interface
- issue informative deprecation warnings when we register adapters
providing Interface.
- Later, switch to looking up using the new interface. Maybe make
this an application option so that people can choose to use the new
interface sooner.
Jim
--
Jim Fulton
Zope Corporation
More information about the Zope-Dev
mailing list