This should be easy, but for I am missing something.
I have an object that works exactly as I expect.
class TextElement(ContentItemElement):
'''
Single String Elements, for example, headlines
'''
def __init__(self, name, data):
super(TextElement, self).__init__()
self.name=name
self.text=data
def prettyPrint(self):
printstring = u'*HTML* '
self.name.encode('utf-8')
printstring += u'<h3> '+self.name+u' </h3>'
self.text.encode('utf-8')
printstring += u'<p> '+self.text+u' </h3>'
print printstring
Ok, great, I can instantiate that, and it does exactly what I want it to. But I really would like to create a more specific version of TextObjects. so I do this:
class CiteElement(TextElement):
'''
Single String Elements, for example, headlines
'''
def __init__(self, name, data):
super(CiteElement, self).__init__()
self.validValues=['Crap I make up', 'Crap I found on the web']
but when I try to instantiate it, this works:
ee = TextElement(element, self.raw[element])
ee.validValues=['Crap I make up', 'Crap I found on the web']
but this Does not
ee = CiteElement(element, self.raw[element])
Instead giving me this error:
TypeError: __init__() takes exactly 3 arguments (1 given)
Obviously I am missing something small. Something key to python objects. Something I should darn well know, but have been coding around for years. But what is it?
Because the constructor of your base class is defined as
And you are calling it without parameters from your derived class.