Discussion:
[Trac-dev] Ticket change validation
Emmanuel BOUAZIZ
2015-03-26 10:34:11 UTC
Permalink
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.

Or is there a better one that I didn't think of ?

thanks for your help,

Emmanuel
--
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+***@googlegroups.com.
To post to this group, send email to trac-***@googlegroups.com.
Visit this group at http://groups.google.com/group/trac-dev.
For more options, visit https://groups.google.com/d/optout.
Ryan Ollos
2015-03-27 21:24:10 UTC
Permalink
On Thu, Mar 26, 2015 at 3:34 AM, Emmanuel BOUAZIZ <
Post by Emmanuel BOUAZIZ
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+***@googlegroups.com.
To post to this group, send email to trac-***@googlegroups.com.
Visit this group at http://groups.google.com/group/trac-dev.
For more options, visit https://groups.google.com/d/optout.
Emmanuel BOUAZIZ
2015-03-31 12:57:40 UTC
Permalink
Post by Ryan Ollos
[...]
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
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
http://trac.edgewall.org/ticket/10125
Thank you, I'll look into that!
--
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+***@googlegroups.com.
To post to this group, send email to trac-***@googlegroups.com.
Visit this group at http://groups.google.com/group/trac-dev.
For more options, visit https://groups.google.com/d/optout.
Loading...