lift the required call to super() in grok.Container subclasses that override __init__

Bug #162286 reported by Martijn Faassen
2
Affects Status Importance Assigned to Milestone
grok
Won't Fix
Wishlist
trollfot
1.1
Won't Fix
Undecided
Unassigned

Bug Description

When you subclass from grok.Container, it's very natural to do something like this:

class MyContainer(grok.Container):
     def __init__(self):
         self.foo = 'bar'

This will fail with some obscure error concerning SampleData (of all things. Martijn's rule: in code, never call anything 'Sample', or 'Simple', or you'll regret it).

To solve this, you need to call super in your own __init__:

class MyContainer(grok.Container):
    def __init__(self):
        super(MyContainer, self).__init__()
        self.foo = 'bar'

We need a grok.Container which doesn't have this commonly surprising requirement.

todd (todd-infrae)
Changed in grok:
assignee: nobody → faassen
milestone: none → 1.0
Revision history for this message
Martijn Faassen (faassen) wrote :

While this would be desirable, this would be non-trivial to fix and the work is therefore deferred to post 1.0.

Changed in grok:
milestone: 1.0 → 1.1
status: New → Confirmed
Revision history for this message
Christian Theune (ctheune) wrote :

In addition I am not sure whether this is desirable. It is a standard Python idiom that you have to do a super call if you override a method and want the code in the super method to be executed.

Changed in grok:
importance: Undecided → Wishlist
Changed in grok:
assignee: Martijn Faassen (faassen) → trollfot (trollfot)
Changed in grok:
status: Confirmed → Won't Fix
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.