-
Notifications
You must be signed in to change notification settings - Fork 4
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
Conversation
collective/auditlog/configure.zcml
Outdated
for="ploneintranet.workspace.interfaces.IWorkspaceCreatedFromTemplateEvent" | ||
handler=".handlers.execute_event" | ||
/> | ||
|
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
Can this one be closed @reinhardt given that the same code has been added to the ploneintranet repos? |
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. |
Is it necessary that c.auditlog has a reference to pi? |
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. |
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. |
Superseded by #20 |
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.