plone - Instantiate a "grok view" with the parameters self.context and self.request in another grok view -
i have site product code this:
class aclass(grok.view): """ code of aclass """ pass class bclass(aclass): """ code of bclass 'update' method defined """ pass class cclass(bclass): def update(self): self.panel = bclass(self.context, self.request) # more code
my doubt why bclass
instantiate/called in cclass
code 2 parameters (self.context
, self.request
). bclass
has update method without other parameters (just self
) , doesn't have __init__
method explicitly. so, what's function of self.context
, self.request
in case? kind of inheritance or acquisition?
after saw this, think didn't understand omnipresent concepts of context , container in plone.
it makes no sense both subclass bclass , have bclass instance. don't understand line self.panel = bclass(self.context, self.request)
supposed achieve.
context , container in no way omnipresent. context object viewing. set in classes __init__
method. container attribute of context, typically __parent__
.
Comments
Post a Comment