def __call__(self):
        """Endpoint for form actions etc.
        """
        protect.CheckAuthenticator(self.request.form)

        url = self.context.absolute_url()

        # only proceed if the form was POSTed
        if not self.request.form.get("submitted", False):
            return self.request.response.redirect(url)

        # only handle one additional path segment to route to a form action
        if len(self.traverse_subpath) != 1:
            return self.request.response.redirect(url)

        # the first path segment is used to determine the endpoint
        func_name = self.traverse_subpath[0]
        action_name = "action_{}".format(func_name)
        action = getattr(self, action_name, None)

        if action is None:
            logger.warn("AttachmentsView.__call__: Unknown action name '{}'"
                        .format(func_name))
            return self.request.response.redirect(url)
        # call the endpoint
        return action()
def __call__ ( self ) : protect . CheckAuthenticator ( self . request . form ) url = self . context . absolute_url ( ) if not self . request . form . get ( "submitted" , False ) : return self . request . response . redirect ( url ) if len ( self . traverse_subpath ) != 1 : return self . request . response . redirect ( url ) func_name = self . traverse_subpath [ 0 ] action_name = "action_{}" . format ( func_name ) action = getattr ( self , action_name , None ) if action is None : logger . warn ( "AttachmentsView.__call__: Unknown action name '{}'" . format ( func_name ) ) return self . request . response . redirect ( url ) return action ( )
Endpoint for form actions etc.