def test_policyWriteRead(self): policy = 'open_policy' policy_writer = IWriteWorkflowPolicySupport(self.proj) policy_writer.setPolicy(policy) policy_reader = IReadWorkflowPolicySupport(self.proj) returned_policy = policy_reader.getCurrentPolicyId() self.failUnless(policy == returned_policy)
def test_projectStateMatches(self): wftool = getToolByName(self.portal, 'portal_workflow') policy_writer = IWriteWorkflowPolicySupport(self.proj) policy_writer.setPolicy('closed_policy') proj_state = wftool.getInfoFor(self.proj, 'review_state') self.failUnless(proj_state == 'closed') policy_writer.setPolicy('open_policy') proj_state = wftool.getInfoFor(self.proj, 'review_state') self.failUnless(proj_state == 'open')
def setPolicy(self, policy_in): count = WFPolicyWriteAdapter.setPolicy(self, policy_in) teams = self.context.getTeams() if teams: policy_data = self._getPolicyData() team_policy_in = policy_data[policy_in]['team_policy'] team = teams[0] team_policy_writer = IWriteWorkflowPolicySupport(team) count += team_policy_writer.setPolicy(team_policy_in) return count
def _initialize_project(project, request): """ This is called by the IAfterProjectAddedEvent to perform after creation to initialize the content within the project. """ project._createTeam() # Set initial security policy policy = request.get('workflow_policy', None) policy_writer = IWriteWorkflowPolicySupport(project) if policy_writer is not None: policy_writer.setPolicy(policy) # @@ move to subscriber project._createIndexPage()