-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 17.12.2012 12:25, Andrej Golcov wrote: > Hi all, > > I'm implementing code listening on ITicketChangeListener interface calls. > I would like to call add_warning in addition to logging just in case if > something go wrong inside the method. The add_warning method requires > request object that is not provided by ITicketChangeListener. > > Is there another way to obtain request object other than get it as > parameter?
The interface is not yet described like Carsten and Peter did for a number of other ExtensionPointInterfaces [1], but there's always the source for reference [2]. As the description tells, it's an "Extension point interface for components that require notification when tickets are created, modified, or deleted." Components, no word about sessions, and if you compare it to other interface definitions you'll see, that the missing request is on purpose. This interface was not meant to work in an interaction context, but to enforce side-effects of ticket changes on other Components. That's it. You may succeed to find an active session and attach i.e. a warning message to it, but that you can doesn't mean you should do so. In fact, you shouldn't. Chances are, that there are 10 or more concurrent active sessions at that time. Which one is right? Decide on req.path_info or similar? No, that's certainly asking for trouble. As someone else already pointed out, there are ITemplateStreamFilter and IRequestHandler. These interfaces allow plugins provide actions on selected request in interactive session context, and you should really find a way with them. Alternatively you could trigger a notification message in Trac's notification system, or - outside of Trac core - use the event driven AnnouncerPlugin [5], that will provide a more flexible framework including transports other than email (think: IM). If you can't go one of these ways, it's likely your concept, that is flawed, not an API deficiency, and you should start by discussing here, what problem you want to solve in the first place. Steffen Hoffmann [1] http://trac.edgewall.org/wiki/TracDev/PluginDevelopment/ExtensionPoints [2] http://trac.edgewall.org/browser/trunk/trac/ticket/api.py#/ITicketChangeListener [3] http://trac.edgewall.org/wiki/TracDev/PluginDevelopment/ExtensionPoints/trac.web.api.IRequestFilter [4] http://trac.edgewall.org/wiki/TracDev/PluginDevelopment/ExtensionPoints/trac.web.api.IRequestHandler [5] http://trac-hacks.org/wiki/AnnouncerPlugin -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAlDPhOsACgkQ31DJeiZFuHce6ACZAfCanUpQ/osSo6awpoJygRjk TEcAnRWaurzk55ilkgAEtlVYtqsdcYXc =wJW2 -----END PGP SIGNATURE----- -- You received this message because you are subscribed to the Google Groups "Trac Development" group. To post to this group, send email to trac-dev@googlegroups.com. To unsubscribe from this group, send email to trac-dev+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/trac-dev?hl=en.