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/worksheet.py 1 location

@@ 1297-1310 (lines=14) @@
1294
            return analyst_member.getProperty('fullname')
1295
        return analyst
1296
1297
    def getObjectWorkflowStates(self):
1298
        """
1299
        This method is used as a metacolumn.
1300
        Returns a dictionary with the workflow id as key and workflow state as
1301
        value.
1302
        :returns: {'review_state':'active',...}
1303
        :rtype: dict
1304
        """
1305
        workflow = getToolByName(self, 'portal_workflow')
1306
        states = {}
1307
        for w in workflow.getWorkflowsFor(self):
1308
            state = w._getWorkflowStateOf(self).id
1309
            states[w.state_var] = state
1310
        return states
1311
1312
    # TODO Workflow - Worksheet - Move to workflow.worksheet.events
1313
    def workflow_script_reject(self):

bika/lims/content/analysisrequest.py 1 location

@@ 2103-2115 (lines=13) @@
2100
        """
2101
        return user_email(self, self.Creator())
2102
2103
    def getObjectWorkflowStates(self):
2104
        """
2105
        This method is used as a metacolumn.
2106
        Returns a dictionary with the workflow id as key and workflow state as
2107
        value.
2108
        :returns: {'review_state':'active',...}
2109
        """
2110
        workflow = getToolByName(self, 'portal_workflow')
2111
        states = {}
2112
        for w in workflow.getWorkflowsFor(self):
2113
            state = w._getWorkflowStateOf(self).id
2114
            states[w.state_var] = state
2115
        return states
2116
2117
    def SearchableText(self):
2118
        """

bika/lims/content/person.py 1 location

@@ 288-299 (lines=12) @@
285
        return self.portal_membership.getMemberById(
286
            self.getUsername()) is not None
287
288
    def getObjectWorkflowStates(self):
289
        """Returns a dictionary with the workflow id as key and workflow state
290
        as value.
291
292
        :returns: {'review_state':'active',...}
293
        """
294
        workflow = getToolByName(self, 'portal_workflow')
295
        states = {}
296
        for w in workflow.getWorkflowsFor(self):
297
            state = w._getWorkflowStateOf(self).id
298
            states[w.state_var] = state
299
        return states
300
301
302
registerType(Person, PROJECTNAME)