Code Duplication    Length = 12-14 lines in 4 locations

bika/lims/content/autoimportlog.py 1 location

@@ 61-73 (lines=13) @@
58
            return self.getInstrument().absolute_url_path()
59
        return None
60
61
    def getObjectWorkflowStates(self):
62
        """
63
        This method is used as a metacolumn.
64
        Returns a dictionary with the workflow id as key and workflow state as
65
        value.
66
        :returns: {'review_state':'active',...}
67
        """
68
        workflow = getToolByName(self, 'portal_workflow')
69
        states = {}
70
        for w in workflow.getWorkflowsFor(self):
71
            state = w._getWorkflowStateOf(self).id
72
            states[w.state_var] = state
73
        return states
74
75
76
# Activating the content type in Archetypes' internal types registry

bika/lims/content/person.py 1 location

@@ 232-243 (lines=12) @@
229
        return self.portal_membership.getMemberById(
230
            self.getUsername()) is not None
231
232
    def getObjectWorkflowStates(self):
233
        """
234
        Returns a dictionary with the workflow id as key and workflow state as
235
        value.
236
        :returns: {'review_state':'active',...}
237
        """
238
        workflow = getToolByName(self, 'portal_workflow')
239
        states = {}
240
        for w in workflow.getWorkflowsFor(self):
241
            state = w._getWorkflowStateOf(self).id
242
            states[w.state_var] = state
243
        return states
244
245
    ### Removed these accessors to prevent confusion when LDAP is used
246
    # def getEmailAddress(self, **kw):

bika/lims/content/worksheet.py 1 location

@@ 1433-1446 (lines=14) @@
1430
    def guard_verify_transition(self):
1431
        return guards.verify(self)
1432
1433
    def getObjectWorkflowStates(self):
1434
        """
1435
        This method is used as a metacolumn.
1436
        Returns a dictionary with the workflow id as key and workflow state as
1437
        value.
1438
        :returns: {'review_state':'active',...}
1439
        :rtype: dict
1440
        """
1441
        workflow = getToolByName(self, 'portal_workflow')
1442
        states = {}
1443
        for w in workflow.getWorkflowsFor(self):
1444
            state = w._getWorkflowStateOf(self).id
1445
            states[w.state_var] = state
1446
        return states
1447
1448
    @security.public
1449
    def workflow_script_submit(self):

bika/lims/content/analysisrequest.py 1 location

@@ 2874-2886 (lines=13) @@
2871
                    break
2872
            return canbeverified
2873
2874
    def getObjectWorkflowStates(self):
2875
        """
2876
        This method is used as a metacolumn.
2877
        Returns a dictionary with the workflow id as key and workflow state as
2878
        value.
2879
        :returns: {'review_state':'active',...}
2880
        """
2881
        workflow = getToolByName(self, 'portal_workflow')
2882
        states = {}
2883
        for w in workflow.getWorkflowsFor(self):
2884
            state = w._getWorkflowStateOf(self).id
2885
            states[w.state_var] = state
2886
        return states
2887
2888
    # TODO Workflow, AnalysisRequest Move to guards.verify?
2889
    def isUserAllowedToVerify(self, member):