# HG changeset patch # User Thierry Florac # Date 1516109084 -3600 # Node ID 00d381f985c80dd3ddb51a0cb1b2b0dc35f1c050 # Parent 5e0acd7fc5f513b1cee115ab4296d689d206e617 Added workflow adapters for content links diff -r 5e0acd7fc5f5 -r 00d381f985c8 src/pyams_content/shared/site/link.py --- a/src/pyams_content/shared/site/link.py Tue Jan 16 14:24:17 2018 +0100 +++ b/src/pyams_content/shared/site/link.py Tue Jan 16 14:24:44 2018 +0100 @@ -17,7 +17,9 @@ # import interfaces from pyams_content.shared.site.interfaces import IContentLink -from pyams_workflow.interfaces import IWorkflow, IWorkflowVersion, IWorkflowVersions, IWorkflowPublicationInfo +from pyams_sequence.interfaces import ISequentialIdInfo +from pyams_workflow.interfaces import IWorkflow, IWorkflowVersion, IWorkflowVersions, IWorkflowPublicationInfo, \ + IWorkflowState # import packages from persistent import Persistent @@ -56,9 +58,32 @@ return target +@adapter_config(context=IContentLink, provides=IWorkflow) +def content_link_workflow_info(context): + """Content link workflow info""" + target = context.get_target() + if target is not None: + return IWorkflow(target, None) + + +@adapter_config(context=IContentLink, provides=IWorkflowState) +def content_link_state_info(context): + """Content link workflow state info""" + target = context.get_target() + if target is not None: + return IWorkflowState(target, None) + + @adapter_config(context=IContentLink, provides=IWorkflowPublicationInfo) def content_link_publication_info(context): """Content link publication info""" target = context.get_target() if target is not None: return IWorkflowPublicationInfo(target, None) + + +@adapter_config(context=IContentLink, provides=ISequentialIdInfo) +def content_link_sequence_info(context): + target = context.get_target() + if target is not None: + return ISequentialIdInfo(target, None)