Mailing List Archive

change comment on submit
hi all,

Is it possible to change the content of a comment on submit? I know I can
hook in to ticket changed event but how do I pass the changes along ? Do I
need to hook into some other method (from an interface) or do it by "hand"
accessing the database?

cheers

Markus

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/CAJ4osOk%3DEpTrAFOPAoudhAt3m6uX9aDeBCa7yud%2Bg8RXF%3DXSRw%40mail.gmail.com.
Re: change comment on submit [ In reply to ]
Hi,

On Tue, Apr 25, 2023 at 10:34?PM Markus Rosjat <markus.rosjat@gmail.com> wrote:
>
> hi all,
>
> Is it possible to change the content of a comment on submit? I know I can hook in to ticket changed event but how do I pass the changes along ? Do I need to hook into some other method (from an interface) or do it by "hand" accessing the database?
>
> cheers
>
> Markus

It is able to validate the comment using
ITicketManipulator.validate_comment() at
https://trac.edgewall.org/browser/tags/trac-1.4.3/trac/ticket/api.py#L178.
However, it is unable to change the comment using the
ITicketManipulator.

Instead, try to replace req.args['comment'] using
IRequestFilter.pre_process_request() when receiveing POST.

--
Jun Omae <jun66j5@gmail.com> (?? ?)

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/CAEVLMahGywNOMMLW-mTWvm86jjYAFywFFr59TqkyLyLZK4GrMA%40mail.gmail.com.
Re: change comment on submit [ In reply to ]
thanks for the advice i will check it out!

cheers

Markus


Am Do., 27. Apr. 2023 um 09:12 Uhr schrieb Jun Omae <jun66j5@gmail.com>:

> Hi,
>
> On Tue, Apr 25, 2023 at 10:34?PM Markus Rosjat <markus.rosjat@gmail.com>
> wrote:
> >
> > hi all,
> >
> > Is it possible to change the content of a comment on submit? I know I
> can hook in to ticket changed event but how do I pass the changes along ?
> Do I need to hook into some other method (from an interface) or do it by
> "hand" accessing the database?
> >
> > cheers
> >
> > Markus
>
> It is able to validate the comment using
> ITicketManipulator.validate_comment() at
> https://trac.edgewall.org/browser/tags/trac-1.4.3/trac/ticket/api.py#L178.
> However, it is unable to change the comment using the
> ITicketManipulator.
>
> Instead, try to replace req.args['comment'] using
> IRequestFilter.pre_process_request() when receiveing POST.
>
> --
> Jun Omae <jun66j5@gmail.com> (?? ?)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Trac Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to trac-users+unsubscribe@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/trac-users/CAEVLMahGywNOMMLW-mTWvm86jjYAFywFFr59TqkyLyLZK4GrMA%40mail.gmail.com
> .
>

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/CAJ4osOn%2B_nbrM1MVQQGDNOQFjpmJqgj_0omifuJ%3DL%2BNe1Q4xdw%40mail.gmail.com.
Re: change comment on submit [ In reply to ]
On Thursday, April 27, 2023 at 2:31:29?PM UTC+2 markus...@gmail.com wrote:

thanks for the advice i will check it out!

cheers

Markus


Also, the following documentation is helpful:

https://trac.edgewall.org/wiki/TracDev/PluginDevelopment/ExtensionPoints/trac.ticket.api.ITicketManipulator
https://trac.edgewall.org/wiki/TracDev/PluginDevelopment/ExtensionPoints/trac.web.api.IRequestFilter

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/0f31a06d-0d6f-459f-bb02-28ce830b0666n%40googlegroups.com.
Re: change comment on submit [ In reply to ]
Hi,

i got my code working now, its a mix of WikiMacroBase expand_macro and
IRequestFilter. So now i can use a macro to add some stuff in the comment
and on commit it will resolve the macro and plug it into the comment so the
macro is removed with informations that need to be persistent.

I know it sounds strange but the idea behind it is to add stuff like date
and authenticated user in the comment with the expand macro in the preview
and later replace the macro code wit the string that is shown in the
preview to make it persistent. if i would leave the macro it would always
take the actual date and the user that is logged in and that defeats the
purpose here.

Cheers

Markus


Am Mo., 8. Mai 2023 um 14:13 Uhr schrieb RjOllos <rjollos@gmail.com>:

>
>
> On Thursday, April 27, 2023 at 2:31:29?PM UTC+2 markus...@gmail.com wrote:
>
> thanks for the advice i will check it out!
>
> cheers
>
> Markus
>
>
> Also, the following documentation is helpful:
>
>
> https://trac.edgewall.org/wiki/TracDev/PluginDevelopment/ExtensionPoints/trac.ticket.api.ITicketManipulator
>
> https://trac.edgewall.org/wiki/TracDev/PluginDevelopment/ExtensionPoints/trac.web.api.IRequestFilter
>
> --
> You received this message because you are subscribed to the Google Groups
> "Trac Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to trac-users+unsubscribe@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/trac-users/0f31a06d-0d6f-459f-bb02-28ce830b0666n%40googlegroups.com
> <https://groups.google.com/d/msgid/trac-users/0f31a06d-0d6f-459f-bb02-28ce830b0666n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/CAJ4osOn46n%2BrCwTi_ZzZx3aALgZM2vDkSCq%3D0NwKF4_QT%3DEsOQ%40mail.gmail.com.