763 principal_id = self.request.principal.id |
763 principal_id = self.request.principal.id |
764 workflow = get_utility(IWorkflow, name=self.context.shared_content_workflow) |
764 workflow = get_utility(IWorkflow, name=self.context.shared_content_workflow) |
765 params = And(Eq(catalog['content_type'], self.context.shared_content_type), |
765 params = And(Eq(catalog['content_type'], self.context.shared_content_type), |
766 Or(Eq(catalog['role:owner'], principal_id), |
766 Or(Eq(catalog['role:owner'], principal_id), |
767 Eq(catalog['role:contributor'], principal_id)), |
767 Eq(catalog['role:contributor'], principal_id)), |
768 Any(catalog['workflow_state'], workflow.readonly_states)) |
768 Any(catalog['workflow_state'], workflow.archived_states)) |
769 return unique(map(lambda x: sorted((version for version in |
769 return unique(map(lambda x: sorted((version for version in |
770 IWorkflowVersions(x).get_versions(IWorkflow(x).readonly_states) |
770 IWorkflowVersions(x).get_versions(workflow.archived_states) |
771 if principal_id in (version.owner | version.contributors)), |
771 if principal_id in (version.owner | version.contributors)), |
772 key=lambda x: IWorkflowState(x).version_id, |
772 key=lambda x: IWorkflowState(x).version_id, |
773 reverse=True)[0], |
773 reverse=True)[0], |
774 CatalogResultSet(CatalogQuery(catalog).query(params, |
774 CatalogResultSet(CatalogQuery(catalog).query(params, |
775 sort_index='modified_date', |
775 sort_index='modified_date', |