TypeError: super(type, obj): obj must be an instance or subtype of type

I get a TypeError: super(type, obj): obj must be an instance or subtype of type when rendering a View which has been reloaded with following code (e.g. as created by bobtemplates.plone):

    def __call__(self):
        # Implement your own actions:
        return super(SomeView, self).__call__()```

Removing the __call__ it reloads. Adding it fails again.

Any idea what the problem is?

To reproduce it:

  1. Add the following to a view
    def __call__(self):
        # Implement your own actions:
        return super(SomeView, self).__call__()```
  1. @@reload code
  2. Access a content with the view
  3. You get the following
Traceback (innermost last):
  Module ZPublisher.WSGIPublisher, line 162, in transaction_pubevents
  Module ZPublisher.WSGIPublisher, line 371, in publish_module
  Module ZPublisher.WSGIPublisher, line 266, in publish
  Module ZPublisher.mapply, line 85, in mapply
  Module ZPublisher.WSGIPublisher, line 63, in call_object
  Module my.package.views.some_view, line 20, in __call__
TypeError: super(type, obj): obj must be an instance or subtype of type
1 Like

Stop/Start your instance. Sometimes it helps.

mekell via Plone Community wrote at 2022-2-6 16:32 +0000:

I get a TypeError: super(type, obj): obj must be an instance or subtype of type when rendering a View which has been reloaded with following code (e.g. as created by bobtemplates.plone):

   def __call__(self):
       # Implement your own actions:
       return super(SomeView, self).__call__()```

Removing the __call__ it reloads. Adding it fails again.

Is self an instance of SomeView?

If you use Python 3, you might try dm.plonepatches.reload.
It contains several improvements over plone.reload - especially
for Python 3.

Plone does not directly use the views you are defining but
mixes them with a wrapper class. This wrapping might confuse
the reload machinery.

1 Like

Old issue: https://github.com/plone/plone.reload/issues/1