Code Duplication    Length = 14-15 lines in 2 locations

src/senaite/core/z3cform/widgets/uidreference/widget.py 1 location

@@ 134-148 (lines=15) @@
131
                    value = attr
132
        return value
133
134
    def get_value(self):
135
        """Extract the value from the request or get it from the field
136
        """
137
        # get the processed value from the `update` method
138
        value = self.value
139
        # the value might come from the request, e.g. on object creation
140
        if isinstance(value, six.string_types):
141
            value = IDataConverter(self).toFieldValue(value)
142
        # we handle always lists in the templates
143
        if value is None:
144
            return []
145
        if not isinstance(value, (list, tuple)):
146
            value = [value]
147
        # just to be sure (paranoid)
148
        return [uid for uid in value if api.is_uid(uid)]
149
150
    def get_api_url(self):
151
        portal = api.get_portal()

src/senaite/core/z3cform/widgets/queryselect/widget.py 1 location

@@ 125-138 (lines=14) @@
122
                    value = attr
123
        return value
124
125
    def get_value(self):
126
        """Extract the value from the request or get it from the field
127
        """
128
        # get the processed value from the `update` method
129
        value = self.value
130
        # the value might come from the request, e.g. on object creation
131
        if isinstance(value, six.string_types):
132
            value = IDataConverter(self).toFieldValue(value)
133
        # we handle always lists in the templates
134
        if value is None:
135
            return []
136
        if not isinstance(value, (list, tuple)):
137
            value = [value]
138
        return value
139
140
    def get_catalog(self):
141
        return self.attr("catalog", "portal_catalog")