Mercurial > p > roundup > code
comparison roundup/cgi/actions.py @ 5452:b50a4c85c270
fixed incorrect usage of BytesIO
| author | Christof Meerwald <cmeerw@cmeerw.org> |
|---|---|
| date | Sun, 22 Jul 2018 22:38:53 +0100 |
| parents | 23b8e6067f7c |
| children | 52cb53eedf77 |
comparison
equal
deleted
inserted
replaced
| 5451:fe1bd8f12a9f | 5452:b50a4c85c270 |
|---|---|
| 1 import re, cgi, time, random, csv, codecs | 1 import re, cgi, time, random, csv, codecs |
| 2 from io import BytesIO | |
| 3 | 2 |
| 4 from roundup import hyperdb, token, date, password | 3 from roundup import hyperdb, token, date, password |
| 5 from roundup.actions import Action as BaseAction | 4 from roundup.actions import Action as BaseAction |
| 6 from roundup.i18n import _ | 5 from roundup.i18n import _ |
| 7 from roundup.cgi import exceptions, templating | 6 from roundup.cgi import exceptions, templating |
| 8 from roundup.mailgw import uidFromAddress | 7 from roundup.mailgw import uidFromAddress |
| 9 from roundup.exceptions import Reject, RejectRaw | 8 from roundup.exceptions import Reject, RejectRaw |
| 10 from roundup.anypy import urllib_ | 9 from roundup.anypy import urllib_ |
| 10 from roundup.anypy.strings import StringIO | |
| 11 | 11 |
| 12 # Also add action to client.py::Client.actions property | 12 # Also add action to client.py::Client.actions property |
| 13 __all__ = ['Action', 'ShowAction', 'RetireAction', 'RestoreAction', 'SearchAction', | 13 __all__ = ['Action', 'ShowAction', 'RetireAction', 'RestoreAction', 'SearchAction', |
| 14 'EditCSVAction', 'EditItemAction', 'PassResetAction', | 14 'EditCSVAction', 'EditItemAction', 'PassResetAction', |
| 15 'ConfRegoAction', 'RegisterAction', 'LoginAction', 'LogoutAction', | 15 'ConfRegoAction', 'RegisterAction', 'LoginAction', 'LogoutAction', |
| 473 # sorted and starting with the "id" column | 473 # sorted and starting with the "id" column |
| 474 props_without_id.sort() | 474 props_without_id.sort() |
| 475 props = ['id'] + props_without_id | 475 props = ['id'] + props_without_id |
| 476 | 476 |
| 477 # do the edit | 477 # do the edit |
| 478 rows = BytesIO(self.form['rows'].value) | 478 rows = StringIO(self.form['rows'].value) |
| 479 reader = csv.reader(rows) | 479 reader = csv.reader(rows) |
| 480 found = {} | 480 found = {} |
| 481 line = 0 | 481 line = 0 |
| 482 for values in reader: | 482 for values in reader: |
| 483 line += 1 | 483 line += 1 |
