Activity log for bug #961705

Date Who What changed Old value New value Message
2012-03-21 22:25:12 Hobson Lane bug added bug
2012-03-21 22:26:01 Hobson Lane description Looks like a local variable, type needs to be defined at the start of _compute_value() because it is used throughout. Alternatively it should us self.type insted of type to raise XmpValueError. It seems there are a lot of repeated patterns that could be turned into static functions to reduce these sorts of errors. Lines 185-204 of src/pyexiv2/xmp.py: def _compute_value(self): # Lazy computation of the value from the raw value if self.type.startswith(('seq', 'bag', 'alt')): type = self.type[4:] if type.lower().startswith('closed choice of'): type = type[17:] self._value = map(lambda x: self._convert_to_python(x, type), self._raw_value) elif self.type == 'Lang Alt': self._value = {} for k, v in self._raw_value.iteritems(): try: self._value[unicode(k, 'utf-8')] = unicode(v, 'utf-8') except TypeError: raise XmpValueError(self._raw_value, type) # FIXME: variable type is undefined here Looks like a local variable, `type`, needs to be defined at the start of XmpTag._compute_value() because it is used throughout. Alternatively compute_value should use self.type insted of type to raise XmpValueError. It seems there are a lot of repeated patterns that could be turned into static functions to reduce these sorts of errors. Lines 185-204 of src/pyexiv2/xmp.py:     def _compute_value(self):         # Lazy computation of the value from the raw value         if self.type.startswith(('seq', 'bag', 'alt')):             type = self.type[4:]             if type.lower().startswith('closed choice of'):                 type = type[17:]             self._value = map(lambda x: self._convert_to_python(x, type), self._raw_value)         elif self.type == 'Lang Alt':             self._value = {}             for k, v in self._raw_value.iteritems():                 try:                     self._value[unicode(k, 'utf-8')] = unicode(v, 'utf-8')                 except TypeError:                     raise XmpValueError(self._raw_value, type) # FIXME: variable type is undefined here
2012-03-21 22:26:35 Hobson Lane branch linked lp:~hobs/pyexiv2/pyexiv2
2012-04-22 19:12:25 Olivier Tilloy pyexiv2: status New Invalid