After upgrade to Plone 5.2, the setupViewletByName from Plone Docs doesn't work

I am in the process of upgrading from Plone 5.1 to Plone 5.2. I am past the initial obstacles pertaining to the upgrade, but I am still working on bringing my custom add-ons up to speed. One of my customizations relies on getting a viewlet by name, which has a Plone Docs example.

def setupViewletByName(self, name):
        """ Constructs a viewlet instance by its name.

        Viewlet update() and render() method are not called.

        @return: Viewlet instance of None if viewlet with name does not exist
        context = aq_inner(self.context)
        request = self.request

        # Perform viewlet regisration look-up
        # from adapters registry
        reg = self.getViewletByName(name)
        if reg == None:
            return None

        # factory method is responsible for creating the viewlet instance
        factory = reg.factory

        # Create viewlet and put it to the acquisition chain
        # Viewlet need initialization parameters: context, request, view
            viewlet = factory(context, request, self, None).__of__(context)
        except TypeError:
            # Bad constructor call parameters
            raise RuntimeError(
                "Unable to initialize viewlet {}. Factory method {} call failed."
                    .format(name, str(factory)))

        return viewlet

The problem is with the line: viewlet = factory(context, request, self, None).__of__(context).

It cannot acquisition wrap. So it gives: AttributeError: 'MyCustomViewlet' object has no attribute '__of__'.

Is there a new equivalent for wrapping the acquisition for a viewlet, or is this a bigger problem with the upgrade from 5.1 to 5.2?

Any help is appreciated. Thank you!

Some quick docs on Acquisition:

Views used to always provide Acquisition.Implicit. See:

I am not sure if this changed, but I decided to add Acquisition.Implicit to my viewlet implementation.

For example:

class MyCustomViewlet(common.GlobalSectionsViewlet,Implicit):

That fixed it, but I would be very interested to know what changed and if that is the best solution. Thanks all!

Plone Foundation Code of Conduct