comparison roundup/cgi/actions.py @ 3178:2ac85e66e9bb maint-0.8

remove rcsv
author Richard Jones <richard@users.sourceforge.net>
date Tue, 15 Feb 2005 00:22:24 +0000
parents 7ca7407133b7
children 79bcf944ceb8
comparison
equal deleted inserted replaced
3177:d2592d790fd8 3178:2ac85e66e9bb
1 #$Id: actions.py,v 1.40.2.4 2005-02-13 22:19:42 richard Exp $ 1 #$Id: actions.py,v 1.40.2.5 2005-02-15 00:22:24 richard Exp $
2 2
3 import re, cgi, StringIO, urllib, Cookie, time, random 3 import re, cgi, StringIO, urllib, Cookie, time, random
4 4
5 from roundup import hyperdb, token, date, password, rcsv 5 from roundup import hyperdb, token, date, password, csv
6 from roundup.i18n import _ 6 from roundup.i18n import _
7 import roundup.exceptions 7 import roundup.exceptions
8 from roundup.cgi import exceptions, templating 8 from roundup.cgi import exceptions, templating
9 from roundup.mailgw import uidFromAddress 9 from roundup.mailgw import uidFromAddress
10 10
251 The "rows" CGI var defines the CSV-formatted entries for the class. New 251 The "rows" CGI var defines the CSV-formatted entries for the class. New
252 nodes are identified by the ID 'X' (or any other non-existent ID) and 252 nodes are identified by the ID 'X' (or any other non-existent ID) and
253 removed lines are retired. 253 removed lines are retired.
254 254
255 """ 255 """
256 # get the CSV module
257 if rcsv.error:
258 self.client.error_message.append(self._(rcsv.error))
259 return
260
261 cl = self.db.classes[self.classname] 256 cl = self.db.classes[self.classname]
262 idlessprops = cl.getprops(protected=0).keys() 257 idlessprops = cl.getprops(protected=0).keys()
263 idlessprops.sort() 258 idlessprops.sort()
264 props = ['id'] + idlessprops 259 props = ['id'] + idlessprops
265 260
266 # do the edit 261 # do the edit
267 rows = StringIO.StringIO(self.form['rows'].value) 262 rows = StringIO.StringIO(self.form['rows'].value)
268 reader = rcsv.reader(rows, rcsv.comma_separated) 263 reader = csv.reader(rows)
269 found = {} 264 found = {}
270 line = 0 265 line = 0
271 for values in reader: 266 for values in reader:
272 line += 1 267 line += 1
273 if line == 1: continue 268 if line == 1: continue
944 939
945 if self.client.env['REQUEST_METHOD'] == 'HEAD': 940 if self.client.env['REQUEST_METHOD'] == 'HEAD':
946 # all done, return a dummy string 941 # all done, return a dummy string
947 return 'dummy' 942 return 'dummy'
948 943
949 writer = rcsv.writer(self.client.request.wfile) 944 writer = csv.writer(self.client.request.wfile)
950 writer.writerow(columns) 945 writer.writerow(columns)
951 946
952 # and search 947 # and search
953 for itemid in klass.filter(matches, filterspec, sort, group): 948 for itemid in klass.filter(matches, filterspec, sort, group):
954 writer.writerow([str(klass.get(itemid, col)) for col in columns]) 949 writer.writerow([str(klass.get(itemid, col)) for col in columns])

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