Hi guys,

Not sure if I need to file these as bugs or not, but:

1. In zope.component.interfaces, unregisterHandler() is defined as:

def unregisterHandler(handler=None, adapts=None, name=u''):

but the implementation in registry.py is:

def unregisterHandler(self, factory=None, required=None, name=u''):

I was reading the interface and trying to pass 'handler' and 'adapts' as keyword arguments, which was failing.

registerHandler() appears to have a similar problem. I haven't checked the other methods in that interface.

2. In zope.component's README.txt, the interface IValidation is like this:

>>> class IValidate(interface.Interface):
...     def validate(ob):
...         """Determine whether the object is valid
...         Return a string describing a validation problem.
...         An empty string is returned to indicate that the
...         object is valid.
...         """

But the implementation is:

>>> class SingleLineSummary:
...     component.adapts(IDocument)
...     interface.implements(IValidate)
...     def __init__(self, doc):
...         self.doc = doc
...     def validate(self):
...         if '\n' in self.doc.summary:
...             return 'Summary should only have one line'
...         else:
...             return ''

I think the validate() method in the interface should be parameter-less.


Zope3-dev mailing list
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to