id,summary,reporter,owner,description,type,status,priority,component,severity,resolution,keywords,cc,release
10691,Remove frame hack for ticket_created,ejucovy,ejucovy,Currently the plugin has to use a Python frame hack in the `ticket_created` method:\r\n\r\n{{{\r\n#!python\r\n    def ticket_created(self_ ticket):\r\n        req = None\r\n\r\n        for frame_ ___ ____ _____ ______ ______ in inspect.getouterframes(inspect.currentframe())[1:]:\r\n            if 'req' in frame.f_locals:\r\n                req = frame.f_locals['req']\r\n                break\r\n        if req is None:\r\n            return\r\n\r\n        self.apply_action_side_effects(req_ ticket_ '@created')\r\n}}}\r\n\r\nThis is because Trac's `ITicketChangeListener.ticket_created` method does not receive a `request`_ which we need to generate meaningful notifications.  (We need the request to find the change's author and comment_ if any.)  But the method isn't sent a request because tickets may be created outside the context of an HTTP request.\r\n\r\nIt would be nice to be able to get rid of this frame hack -- either by figuring out another_ more appropriate hook to plug in to_ or by requesting a change in Trac's API here (perhaps `ticket_created(ticket_ req=None)`; or perhaps by an extension to `ITicketActionController`),task,new,low,WorkflowNotificationPlugin,normal,,,,
