You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A client has defined an after_publish_page hook in their project, to perform an action after a page is published. They would like this action to be triggered on publishing a translation too, but since wagtail-localize uses the before_edit_page hook to completely bypass the usual Wagtail edit view, the code path that calls the after_publish_page hook is not reached.
The page_published signal still works, but this doesn't provide access to the request/response cycle, e.g. to output a custom 'success' message or redirect the user elsewhere.
I propose that the publish action for translations should invoke either the after_publish_page hook, or a new after_publish_translation hook. I would lean slightly toward the latter, as hook functions receive the request object and existing projects might have logic that assumes certain properties of the request (such as POST parameters) that are valid for the regular view but not the translation form, and we don't want those to break suddenly when we start calling the hook from a new place. (Digging into things like POST parameters is undocumented behaviour though, so it probably would be fair game to break it.)
The text was updated successfully, but these errors were encountered:
A client has defined an
after_publish_page
hook in their project, to perform an action after a page is published. They would like this action to be triggered on publishing a translation too, but since wagtail-localize uses thebefore_edit_page
hook to completely bypass the usual Wagtail edit view, the code path that calls theafter_publish_page
hook is not reached.The
page_published
signal still works, but this doesn't provide access to the request/response cycle, e.g. to output a custom 'success' message or redirect the user elsewhere.I propose that the publish action for translations should invoke either the
after_publish_page
hook, or a newafter_publish_translation
hook. I would lean slightly toward the latter, as hook functions receive therequest
object and existing projects might have logic that assumes certain properties of the request (such as POST parameters) that are valid for the regular view but not the translation form, and we don't want those to break suddenly when we start calling the hook from a new place. (Digging into things like POST parameters is undocumented behaviour though, so it probably would be fair game to break it.)The text was updated successfully, but these errors were encountered: