- # same considerations on unicode as in set() apply here
- try:
- value = value if isinstance(value, basestring) else str(value)
- self._write('%s %s %s\r\n%s\r\n' % (
- 'LPUSH' if tail else 'RPUSH', name, len(value), value
- ))
- except UnicodeEncodeError, e:
- raise InvalidData("Error encoding unicode value for element in list '%s': %s." % (name, e))
+ value = self._encode(value)
+ self._write('%s %s %s\r\n%s\r\n' % (
+ 'LPUSH' if tail else 'RPUSH', name, len(value), value
+ ))