[Zope3-dev] Allowing views to be registered for classes ratherthaninterfaces.

Garrett Smith garrett@mojave-corp.com
Fri, 18 Jul 2003 13:16:48 -0500


Jim Fulton wrote:
> Subject: Re: [Zope3-dev] Allowing views to be registered for classes
> ratherthaninterfaces.
>=20
>=20
> Garrett Smith wrote:
>=20
> ...
>=20
>> Developers have to go through ZCML to define class permissions. What
>> about an option, in the content or class directives, to define an
>> implicit interface -- like a macro. I'm not sure what this would look
>> like...an 'interface' or 'schema' or multiple 'method/attribute'
>> subdirectives.=20
>>=20
>> This could serve the primary purpose, if I understand Jim's main
>> concern, for explicit contract definition. It would also ensure that
>> an interface and class were always in sync, eliminating the tedium
>> that Martijn mentioned in an earlier message.
>>=20
>> This is also a common Zope 3 pattern -- supporting certain
>> definition/registration tasks in ZCML that would otherwise be
>> required in Python.
>=20
> I can't figure out what you are suggesting here.

Something like this:

 <class class=3D"Foo">
   <implements interface=3D"IFoo"  auto_generate=3D"True" />
 </class>

would cause an interface "IFoo" to be created and registered -- perhaps
including public methods and attributes of Foo.

 -- Garrett