geopython / pywps

PyWPS is an implementation of the Web Processing Service standard from the Open Geospatial Consortium. PyWPS is written in Python.
https://pywps.org
MIT License
178 stars 117 forks source link

fix incorrect use of self.__class__ in super #578

Closed fmigneault closed 3 years ago

fmigneault commented 3 years ago

Overview

Fix incorrect use of self.__class__ in super call.

Additional Information

In the actual context, it just so happens that self.__class__ is equal to ExecuteResponse and produces the same result. When that class is derived though, to add additional functionalities, the value changes and causes endless recursion.

class DerivedExecuteResponse(ExecuteResponse): 
    def __init__(self, wps_request, uuid):
        super(ExecuteResponse, self).__init__(wps_request, uuid)
        # other setup... 

class ExecuteResponse(WPSResponse):
    def __init__(self, wps_request, uuid, **kwargs):
        # here 'self.__class__'  == 'DerivedExecuteResponse'
        # 'super(self.__class__, self)' resolves to 'ExecuteResponse', so it calls itself !
        super(self.__class__, self).__init__(wps_request, uuid)

Contribution Agreement

(as per https://github.com/geopython/pywps/blob/master/CONTRIBUTING.rst#contributions-and-licensing)

coveralls commented 3 years ago

Coverage Status

Coverage remained the same at 0.0% when pulling 427072489c85a770f78e1421ae0d25b0d4a34803 on fmigneault:super-class into e10c99c2c8472287f9463bab49d85f5e7597cac2 on geopython:pywps-4.4.

fmigneault commented 3 years ago

@cehbrecht Would be great if that can be integrated in #577 So far only found this problem while using 4.4, the rest seems to work correctly.

cehbrecht commented 3 years ago

@fmigneault Thanks for the fix 👍 I will update the release notes.