MultiAdapter example in grokcore.component can not work

Bug #556383 reported by Wichert Akkerman
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
grok
Fix Committed
Undecided
Unassigned

Bug Description

grokcore.component has this example:

class HelloWorldProvider(grokcore.component.MultiAdapter):
    """Display Hello World!"""
    grokcore.component.adapts(Interface, IBrowserRequest, IBrowserPage)
    grokcore.component.implements(IContentProvider)

    def update(self):
        pass

    def render(self):
        return u'<p>Hello World!</p>'

This code can never work, since unlike grokcore.component.Adapter MultiAdapter does not define a __init__ constructor. As a result an attempt to use this adapter results in an error message:

TypeError: 'object.__new__() takes no parameters'

Changed in grok:
status: New → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.