django - Python - inheritance - constructor not called -


this class structure:

class mymixin(object):     def __init__(self, **kwargs):         super(mymixin, self).__init__(**kwargs)  class mybaseview(mymixin, templateview):     def __init__(self, **kwargs):         print 'mybaseview init'         super(mybaseview, self).__init__(**kwargs)  class mycommonview(mybaseview):     def __init__(self, **kwargs):         print 'mycommonview init'         super(mycommonview, self).__init__(**kwargs)  class myview(mycommonview):     def __init__(self, **kwargs):         print 'myview init'         super(myview, self).__init__(**kwargs) 

in urls.py:

url(r'^some/url/$', myview.as_view()) 

also, there instance variables defined in each constructor. didn't write them here because don't think relevant.

result... myview , mycommonview init messages printed, mybaseview doesn't. so, mybaseview's constructor never gets called. know fact constructor isn't called because see things not initialized properly, prints here demonstrate not called.

why? causing this? how resolve it?

thanks.

ok, weird hell, it's resolved now.

i had of these classes inside submodule in project. submodule removed project standalone app (installable in virtualenv via pip). did install locally , did pull latest revision of project revision control, revision doesn't include submodule more.

long story short, submodule removed, directory remained along .pyc files inside. these file outdated , project using them reason , why didn't work.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -