Exemple #1
0
def delete_action(wf, context):  # pylint: disable=invalid-name,unused-argument
    """Delete draft version, and parent if single version"""
    versions = IWorkflowVersions(context)
    versions.remove_version(IWorkflowState(context).version_id)
    if not versions.get_last_versions():
        document = get_parent(versions, IDocument)
        folder = get_parent(document, IDocumentFolder)
        del folder[document.__name__]
Exemple #2
0
def get_last_version(content):
    """Helper function used to get last content version"""
    versions = IWorkflowVersions(content, None)
    if versions is None:
        return None
    result = versions.get_last_versions()
    if result:
        return result[0]
    return None