Code Duplication    Length = 11-11 lines in 2 locations

bika/lims/browser/sample/edit.py 1 location

@@ 43-53 (lines=11) @@
40
    def now(self):
41
        return DateTime()
42
43
    def getDefaultSpec(self):
44
        """ Returns 'lab' or 'client' to set the initial value of the
45
            specification radios
46
        """
47
        mt = getToolByName(self.context, 'portal_membership')
48
        pg = getToolByName(self.context, 'portal_groups')
49
        member = mt.getAuthenticatedMember()
50
        member_groups = [pg.getGroupById(group.id).getGroupName() \
51
                         for group in pg.getGroupsByUserId(member.id)]
52
        default_spec = ('Clients' in member_groups) and 'client' or 'lab'
53
        return default_spec
54
55
    def __call__(self):
56
        if 'transition' in self.request.form:

bika/lims/browser/analysisrequest/view.py 1 location

@@ 374-384 (lines=11) @@
371
        cats = self.getDefaultCategories()
372
        return [cat.UID() for cat in cats]
373
374
    def getDefaultSpec(self):
375
        """ Returns 'lab' or 'client' to set the initial value of the
376
            specification radios
377
        """
378
        mt = getToolByName(self.context, 'portal_membership')
379
        pg = getToolByName(self.context, 'portal_groups')
380
        member = mt.getAuthenticatedMember()
381
        member_groups = [pg.getGroupById(group.id).getGroupName()
382
                         for group in pg.getGroupsByUserId(member.id)]
383
        default_spec = ('Clients' in member_groups) and 'client' or 'lab'
384
        return default_spec
385
386
    def getAnalysisProfileTitle(self):
387
        """Grab the context's current AnalysisProfile Title if any