Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle IWorkspaceCreatedFromTemplateEvent #17

Closed
wants to merge 2 commits into from

Conversation

reinhardt
Copy link
Contributor

See https://github.com/quaive/ploneintranet/pull/2016

We need a subscriber directive and an entry in the case distinction so that the audit machinery is activated.

for="ploneintranet.workspace.interfaces.IWorkspaceCreatedFromTemplateEvent"
handler=".handlers.execute_event"
/>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this subscriber be moved to ploneintranet?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, collective.auditlog should also work without ploneintranet, so either this needs to be wrapped in a condition or moved elsewhere. On the other hand ploneintranet is also independent from collective.auditlog, so we would need a condition there as well. Then there's the fact that we already have the conditional import here in action.py

I don't think there's a completely clean way to do it. If you prefer I'll move the subscriber to ploneintranet.

@ale-rt
Copy link
Member

ale-rt commented Jul 26, 2018

Can this one be closed @reinhardt given that the same code has been added to the ploneintranet repos?

@reinhardt
Copy link
Contributor Author

No, the changes in action.py are still necessary or the event will be ignored. I've taken out the subscriber that's now in ploneintranet.

I'd actually like to refactor action.py and try to abstract away all the various explicit checks for various interfaces, but that'll have to wait.

@pilz
Copy link
Member

pilz commented Jul 26, 2018

Is it necessary that c.auditlog has a reference to pi?

@reinhardt
Copy link
Contributor Author

At the moment yes, unless I would invest more time to do the refactoring that I mentioned (which may not work as I imagine it; it's currently just a vague idea).

The problem is that in action.py there are a lot of explicit checks for interfaces on the triggering event. Among other things the action verb is assigned ('added', 'modified', ...). If no interface matches then the audit action is aborted and a warning logged. This would happen to IWorkspaceCreatedFromTemplateEvent as well if we don't explicitly check for it.

I would like to try to factor out the verb assignment and any additional actions and maybe move them to adapters or similar. But I'm not sure it's worth the additional time at the moment.

@reinhardt
Copy link
Contributor Author

I've created #18 to make this explicit. If we find a solution there then this will be obsolete. Also there is a PR for a patch in our external code that works around it.

@ale-rt
Copy link
Member

ale-rt commented Aug 30, 2018

Superseded by #20

@ale-rt ale-rt closed this Aug 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants