I Checked the zope.interface implementation. It seems like this one
does not do any validation at all. consider folowing code

from zope import interface


class IBase(interface.Interface):
    def my_method(self):
        pass


class Child():
    interface.implements(IBase)

if __name__ == '__main__':
    print IBase.implementedBy(Child)  # returns True


Here I implement a IBase Interface that has "my_method". Then I wrote
a Child class to use this interface but I don't have my_method inside
Child method. With abc implementation I at least have an error for
that design mistake. but I don't get this error in zope version.

On Jan 4, 2:49 pm, Thomas Weholt <thomas.weh...@gmail.com> wrote:
> He probably meant zope.interface :-)
>
> Regards,
> Thomas
>
>
>
>
>
>
>
>
>
> On Wed, Jan 4, 2012 at 1:47 PM, huseyin yilmaz <yilmazhuse...@gmail.com> 
> wrote:
> > Could you direct me to an example (or documentation). I could not find
> > any source about zone.interface.
>
> > On Jan 4, 2:17 pm, Donald Stufft <donald.stu...@gmail.com> wrote:
> >> Why not use zone.interface
>
> >> On Wednesday, January 4, 2012 at 7:07 AM, huseyin yilmaz wrote:
> >> > Hi everybody,
>
> >> > I want to implement interface functionality in python. I wrote
> >> > following sample code
>
> >> >https://gist.github.com/1559689
>
> >> > Here I use an abc as an interface.
> >> > Couple of my models are implementing this interface and one of my
> >> > consumer model is using those models. In this implementation, I use my
> >> > abstract class to check if my models are implementing enough
> >> > functionality to make consumer model methods work (use_object method).
>
> >> > Since I used abc's here, I get an error as soon as I try to
> >> > instantiate a model object. (I do not need to invoke use_object method
> >> > for validation to work.)
>
> >> > Question 1) Is there a better way to implement this validation
> >> > functionality.
> >> > Question 2) In this implementation, Validation happens at object
> >> > instantiation time. Which means If I don't instantiate any object I
> >> > won't get any error, Is there a ( short ) way of getting this check on
> >> > code initialization? ( I am not dynamicly changing methods of my
> >> > models)
>
> >> > --
> >> > You received this message because you are subscribed to the Google 
> >> > Groups "Django users" group.
> >> > To post to this group, send email to django-users@googlegroups.com 
> >> > (mailto:django-users@googlegroups.com).
> >> > To unsubscribe from this group, send email to 
> >> > django-users+unsubscr...@googlegroups.com 
> >> > (mailto:django-users+unsubscr...@googlegroups.com).
> >> > For more options, visit this group 
> >> > athttp://groups.google.com/group/django-users?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/django-users?hl=en.
>
> --
> Mvh/Best regards,
> Thomas Weholthttp://www.weholt.org

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to