comparison roundup/cgi/actions.py @ 4521:abd2db0a159a

Fix StringIO issue2550713: - io.StringIO in newer versions of python returns unicode strings and expects a unicode string in the constructor. Unfortunately csv doesn't handle unicode (yet). So we need to use a BytesIO which gets the utf-8 string from the web-interface. Compatibility for old versions by using Stringio.Stringio for emulating a io.BytesIO also works. - We didn't have a regression test for the EditCSVAction
author Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
date Fri, 15 Jul 2011 12:36:47 +0000
parents 693c75d56ebe
children 4f9c3858b671
comparison
equal deleted inserted replaced
4520:182d8c41a3aa 4521:abd2db0a159a
295 # sorted and starting with the "id" column 295 # sorted and starting with the "id" column
296 props_without_id.sort() 296 props_without_id.sort()
297 props = ['id'] + props_without_id 297 props = ['id'] + props_without_id
298 298
299 # do the edit 299 # do the edit
300 rows = io_.StringIO(self.form['rows'].value) 300 rows = io_.BytesIO(self.form['rows'].value)
301 reader = csv.reader(rows) 301 reader = csv.reader(rows)
302 found = {} 302 found = {}
303 line = 0 303 line = 0
304 for values in reader: 304 for values in reader:
305 line += 1 305 line += 1

Roundup Issue Tracker: http://roundup-tracker.org/