[Zope3-dev] PROPOSAL: Make ItoIRegistry part of Interface package
Phillip J. Eby
pje@telecommunity.com
Wed, 05 Jun 2002 07:21:15 -0500
Rationale: ItoIRegistry has virtually no dependencies to the rest of Zope,
but would be useful as part of a generally-distributed Interface
package. Other frameworks such as TransWarp and Twisted could make use of
ItoIRegistry classes without being dependent on a "sumo" Zope
distribution. Also, ItoIRegistry could be used to implement a PEP 246-like
Python adaptation system. The resulting package would have a stronger case
for becoming a Python standard library in the future.
Changes needed:
* ItoIRegistry currently strips proxies in the getForObject() and
getAllForObject() methods. Most of its callers (all the global services)
*also* strip proxies, others (Event-related channels/services) do
not. This would need to change to either all callers stripping proxies, or
else the proxy stripping registry would need to move to the Interface
package, or be shipped with it. (Ugh.) I think that the semantics are
actually cleaner if callers explicitly strip their own proxies, since there
is currently no way to use an ItoIRegistry which looks up things for
proxies themselves (as opposed to what they proxy)!
* ItoIRegistry uses the 'Invalid' exception from
Zope.ComponentArchitecture.Exceptions to indicate a failed registration due
to a component lacking a promised interface. This would need to be
replaced with a TypeError or something else available from the Interface
package.
With these changes, ItoIRegistry could move to the Interface package,
making it an even more valuable tool for third-party frameworks. That
should help to make the Interface package more popular, which benefits Zope
and everyone else who uses Interfaces. (Because the more standard it
becomes, the more people want to use it, so the more standard it becomes,
so it's accepted in more places, and so on, and so on...)