Пример #1
0
def get_file_versions(request, oid, fields=None):
    """Get all document versions properties"""
    document = get_document(request, oid)
    versions = IWorkflowVersions(document)
    result = []
    for version in versions.get_versions(sort=True):
        result.append(version.to_json(fields))
    return result
Пример #2
0
 def fire_transition_for_versions(self,
                                  state,
                                  transition_id,
                                  comment=None,
                                  principal=None,
                                  request=None):
     # pylint: disable=too-many-arguments
     """Fire transition for all versions in given state"""
     versions = IWorkflowVersions(self.parent)
     for version in versions.get_versions(state):
         IWorkflowInfo(version).fire_transition(transition_id,
                                                comment,
                                                principal=principal,
                                                request=request)
Пример #3
0
 def is_published(self, check_parent=True):
     """Check if content is published"""
     # check is parent is also published...
     if check_parent:
         parent = get_parent(self.__parent__,
                             IWorkflowPublicationSupport,
                             allow_context=False)
         if (parent is not None
             ) and not IWorkflowPublicationInfo(parent).is_published():
             return False
     # associated workflow?
     workflow = IWorkflow(self.__parent__, None)
     if (workflow is not None) and not workflow.visible_states:
         return False
     # check content versions
     versions = IWorkflowVersions(self.__parent__, None)
     if (versions is not None) and not versions.get_versions(
             workflow.visible_states):
         return False
     now = tztime(datetime.utcnow())
     return (self.publication_effective_date is not None) and \
            (self.publication_effective_date <= now) and \
            ((self.publication_expiration_date is None) or
             (self.publication_expiration_date >= now))