Code Duplication    Length = 15-15 lines in 2 locations

bika/lims/browser/samplinground/printform.py 1 location

@@ 31-45 (lines=15) @@
28
    _samplingrounds = []
29
30
    def __call__(self):
31
        if self.context.portal_type == 'SamplingRound':
32
            self._samplingrounds = [self.context]
33
34
        elif self.context.portal_type == 'SamplingRounds' \
35
                and self.request.get('items', ''):
36
            uids = self.request.get('items').split(',')
37
            uc = getToolByName(self.context, 'uid_catalog')
38
            self._samplingrounds = [obj.getObject() for obj in uc(UID=uids)]
39
40
        else:
41
            # Warn and redirect to referer
42
            logger.warning('PrintView: type not allowed: %s' %
43
                            self.context.portal_type)
44
            self.destination_url = self.request.get_header("referer",
45
                                   self.context.absolute_url())
46
47
        # Do print?
48
        if self.request.form.get('pdf', '0') == '1':

bika/lims/browser/worksheet/views/printview.py 1 location

@@ 62-76 (lines=15) @@
59
            pdf for the worksheet.
60
        """
61
62
        if self.context.portal_type == 'Worksheet':
63
            self._worksheets = [self.context]
64
65
        elif self.context.portal_type == 'WorksheetFolder' and \
66
                self.request.get('items', ''):
67
            uids = self.request.get('items').split(',')
68
            uc = getToolByName(self.context, 'uid_catalog')
69
            self._worksheets = [obj.getObject() for obj in uc(UID=uids)]
70
71
        else:
72
            # Warn and redirect to referer
73
            logger.warning('PrintView: type not allowed: %s' %
74
                           self.context.portal_type)
75
            self.destination_url = self.request.get_header(
76
                "referer", self.context.absolute_url())
77
78
        # Generate PDF?
79
        if self.request.form.get('pdf', '0') == '1':