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

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

bika/lims/content/analysisrequest.py 1 location

@@ 2734-2746 (lines=13) @@
2731
        """
2732
        return user_email(self, self.Creator())
2733
2734
    def getObjectWorkflowStates(self):
2735
        """
2736
        This method is used as a metacolumn.
2737
        Returns a dictionary with the workflow id as key and workflow state as
2738
        value.
2739
        :returns: {'review_state':'active',...}
2740
        """
2741
        workflow = getToolByName(self, 'portal_workflow')
2742
        states = {}
2743
        for w in workflow.getWorkflowsFor(self):
2744
            state = w._getWorkflowStateOf(self).id
2745
            states[w.state_var] = state
2746
        return states
2747
2748
    @security.public
2749
    def guard_to_be_preserved(self):