Re: [Zope3-Users] classProvides and inheritance
On Sat, 2009-08-15 at 17:18 -0400, Jim Fulton wrote: > On Sat, Aug 15, 2009 at 5:06 PM, Iain Duncan wrote: > > On Sat, 2009-08-15 at 16:57 -0400, Jim Fulton wrote: > >> On Sat, Aug 15, 2009 at 4:49 PM, Iain Duncan wrote: > ... > > I understood that, I just phrased my question poorly. > > np > > > So given the > > clarification, is there a straightforward way for me to make it so, > > No. > > > or > > will I need to make a metaclass that enforces my desired behaviour? > > I don't think a meta class would help you. You would need to > implement an alternative __provides__ descriptor. At that point, > you'd be depending on an internal implementation detail, but you > wouldn't be the first. :/ Thanks, maybe I need to rethink that part then. iain ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] classProvides and inheritance
On Sat, Aug 15, 2009 at 5:06 PM, Iain Duncan wrote: > On Sat, 2009-08-15 at 16:57 -0400, Jim Fulton wrote: >> On Sat, Aug 15, 2009 at 4:49 PM, Iain Duncan wrote: ... > I understood that, I just phrased my question poorly. np > So given the > clarification, is there a straightforward way for me to make it so, No. > or > will I need to make a metaclass that enforces my desired behaviour? I don't think a meta class would help you. You would need to implement an alternative __provides__ descriptor. At that point, you'd be depending on an internal implementation detail, but you wouldn't be the first. :/ Jim -- Jim Fulton ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] classProvides and inheritance
On Sat, 2009-08-15 at 16:57 -0400, Jim Fulton wrote: > On Sat, Aug 15, 2009 at 4:49 PM, Iain Duncan wrote: > > Hi, I'm new here so please tell me if this is the wrong list. > > > > I have a case where I want a class, ( the class object itself, not an > > instantiated class ) to provide an interface so that a utility look up > > can get me the class itself. This is working ok with: > > > > class IPet(PersistentResource): > > implements(Pet) > > classProvides(IResourceClass) > > > > but, all classes that inherit from PersistentResource should provide > > this too, > > That's a matter of opinion. Sorry, my sentence came across wrong! I definitely did not mean that the ZCA should make it so by default, I meant that in my particular application I would like it to be that way without necessarily having to add a classProvides statement to each derived class. My fault for not being more clear. > > > and this does not get inherited just by using classProvides in > > the definitiation of PersistentResource. > > > > Before I go making metaclasses and stuff, thought I should check if I am > > missing something simple! > > No. Class provides isn't inherited by design. I understood that, I just phrased my question poorly. So given the clarification, is there a straightforward way for me to make it so, or will I need to make a metaclass that enforces my desired behaviour? thanks! Iain ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] classProvides and inheritance
On Sat, Aug 15, 2009 at 4:49 PM, Iain Duncan wrote: > Hi, I'm new here so please tell me if this is the wrong list. > > I have a case where I want a class, ( the class object itself, not an > instantiated class ) to provide an interface so that a utility look up > can get me the class itself. This is working ok with: > > class IPet(PersistentResource): > implements(Pet) > classProvides(IResourceClass) > > but, all classes that inherit from PersistentResource should provide > this too, That's a matter of opinion. > and this does not get inherited just by using classProvides in > the definitiation of PersistentResource. > > Before I go making metaclasses and stuff, thought I should check if I am > missing something simple! No. Class provides isn't inherited by design. Jim -- Jim Fulton ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users