On 11.01.2013, at 20:53, Daniel Nouri <
daniel...@gmail.com> wrote:
> On Fri, Jan 11, 2013 at 8:22 AM, Lingfeng Xiong <
xiongl...@gmail.com> wrote:
>> I want to add a Action for a self-defined ContentType. For example, I
>> defined a ContentType named 'Server', and I want to add a Action for it,
>> like 'Resync State'. I have read the code in kotti/view/edit/actions.py, but
>> I believe Action is global... so any idea to add a ContentType special
>> Action? Or any future plan to add such support?
> With the existing code what you can do is override the view, call the
> original, and conditionally add your own action. But it's not too
> elegant. And only one add-on can do it.
>
> Your idea of adding contet-type specific actions sounds fine to me.
> I'm open for a pull request that adds to Content.type_info a list of
> type-specific actions, similar to edit_links. This should be easy
> enough to add though it needs docs and a test.
+1 for the content type specific actions.
For this particular use case there could be another solution: you could
implement a custom workflow for your content type with a (not so) final
state "synced" that has only a transition "resync" with destination
state also set to "synced" (kind of recursive). You could then
subscribe to the WorkflowTransition event and do your sync code in the
subscriber.
Andreas