

def _loginSucceeded(self, args):
    '\n        Handle login success by wrapping the resulting L{IResource} avatar\n        so that the C{logout} callback will be invoked when rendering is\n        complete.\n        '
    (interface, avatar, logout) = args

    class ResourceWrapper(proxyForInterface(IResource, 'resource')):
        '\n            Wrap an L{IResource} so that whenever it or a child of it\n            completes rendering, the cred logout hook will be invoked.\n\n            An assumption is made here that exactly one L{IResource} from\n            among C{avatar} and all of its children will be rendered.  If\n            more than one is rendered, C{logout} will be invoked multiple\n            times and probably earlier than desired.\n            '

        def getChildWithDefault(self, name, request):
            '\n                Pass through the lookup to the wrapped resource, wrapping\n                the result in L{ResourceWrapper} to ensure C{logout} is\n                called when rendering of the child is complete.\n                '
            return ResourceWrapper(self.resource.getChildWithDefault(name, request))

        def render(self, request):
            '\n                Hook into response generation so that when rendering has\n                finished completely (with or without error), C{logout} is\n                called.\n                '
            request.notifyFinish().addBoth((lambda ign: logout()))
            return super(ResourceWrapper, self).render(request)
    return ResourceWrapper(avatar)

dataset/ETHPy150Open twisted/twisted/twisted/web/_auth/wrapper.py HTTPAuthSessionWrapper._loginSucceeded/original