On Thu, Mar 26, 2015 at 3:34 AM, Emmanuel BOUAZIZ <
emmanuel.boua...@gmail.com> wrote:

> Hi,
>
> I'm looking to add a simple ticket change validation to our Trac (i.e
> prevent to close the ticket if some conditions are not met).
>
> I figured that a simple plugin implementing ITicketManipulator would be
> nice and wrote a basic one for test purpose, but it only works for
> modifications made from the web interface, and I'd like to be able to
> validate the modifications made from the trac commit hooks too.
>
> I tried to put the extension point in the Trac PreCommitHook like it is in
> the TicketModule but it fails because CommitHook's are not Component's.
>
> The remaining solution appears to be writing a piece of code that makes
> the validation and call it from both the pre-commit-hook and a Trac plugin
> implementing ITicketManipulator.
>

As far as I know that is your best option. You could implement the
IAdminCommandProvider interface and call the command from the pre-commit
hook . You could model this after CommitTicketUpdater and
DbRepositoryProvider:
http://trac.edgewall.org/browser/trunk/tracopt/ticket/commit_updater.py?rev=13600&marks=160,167#L158
http://trac.edgewall.org/browser/trunk/trac/versioncontrol/api.py?rev=13846&marks=118,140#L115

There is some related discussion in #10125:
http://trac.edgewall.org/ticket/10125

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to trac-dev+unsubscr...@googlegroups.com.
To post to this group, send email to trac-dev@googlegroups.com.
Visit this group at http://groups.google.com/group/trac-dev.
For more options, visit https://groups.google.com/d/optout.

Reply via email to