Skip to content

Commit 51a4618

Browse files
author
Richard Jones
committed
remove rcsv
1 parent aac326a commit 51a4618

File tree

3 files changed

+18
-24
lines changed

3 files changed

+18
-24
lines changed

roundup/admin.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@
1616
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1717
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1818
#
19-
# $Id: admin.py,v 1.85 2004-11-09 23:12:11 richard Exp $
19+
# $Id: admin.py,v 1.85.2.1 2005-02-15 00:22:23 richard Exp $
2020

2121
'''Administration commands for maintaining Roundup trackers.
2222
'''
2323
__docformat__ = 'restructuredtext'
2424

2525
import sys, os, getpass, getopt, re, UserDict, shutil, rfc822
26-
from roundup import date, hyperdb, roundupdb, init, password, token, rcsv
26+
from roundup import date, hyperdb, roundupdb, init, password, token, csv
2727
from roundup import __version__ as roundup_version
2828
import roundup.instance
2929
from roundup.configuration import CoreConfig
@@ -1037,8 +1037,6 @@ def do_export(self, args):
10371037
# grab the directory to export to
10381038
if len(args) < 1:
10391039
raise UsageError, _('Not enough arguments supplied')
1040-
if rcsv.error:
1041-
raise UsageError, _(rcsv.error)
10421040

10431041
dir = args[-1]
10441042

@@ -1048,12 +1046,15 @@ def do_export(self, args):
10481046
else:
10491047
classes = self.db.classes.keys()
10501048

1049+
class colon_separated(csv.excel):
1050+
delimiter = ':'
1051+
10511052
# do all the classes specified
10521053
for classname in classes:
10531054
cl = self.get_class(classname)
10541055

10551056
f = open(os.path.join(dir, classname+'.csv'), 'w')
1056-
writer = rcsv.writer(f, rcsv.colon_separated)
1057+
writer = csv.writer(f, colon_separated)
10571058

10581059
properties = cl.getprops()
10591060
propnames = cl.export_propnames()
@@ -1072,7 +1073,7 @@ def do_export(self, args):
10721073

10731074
# export the journals
10741075
jf = open(os.path.join(dir, classname+'-journals.csv'), 'w')
1075-
journals = rcsv.writer(jf, rcsv.colon_separated)
1076+
journals = csv.writer(jf, colon_separated)
10761077
map(journals.writerow, cl.export_journals())
10771078
jf.close()
10781079
return 0
@@ -1099,13 +1100,14 @@ def do_import(self, args):
10991100
'''
11001101
if len(args) < 1:
11011102
raise UsageError, _('Not enough arguments supplied')
1102-
if rcsv.error:
1103-
raise UsageError, _(rcsv.error)
11041103
from roundup import hyperdb
11051104

11061105
# directory to import from
11071106
dir = args[0]
11081107

1108+
class colon_separated(csv.excel):
1109+
delimiter = ':'
1110+
11091111
# import all the files
11101112
for file in os.listdir(dir):
11111113
classname, ext = os.path.splitext(file)
@@ -1117,7 +1119,7 @@ def do_import(self, args):
11171119

11181120
# ensure that the properties and the CSV file headings match
11191121
f = open(os.path.join(dir, file), 'rU')
1120-
reader = rcsv.reader(f, rcsv.colon_separated)
1122+
reader = csv.reader(f, csv.colon_separated)
11211123
file_props = None
11221124
maxid = 1
11231125
# loop through the file and create a node for each entry
@@ -1135,7 +1137,7 @@ def do_import(self, args):
11351137

11361138
# import the journals
11371139
f = open(os.path.join(args[0], classname + '-journals.csv'), 'rU')
1138-
reader = rcsv.reader(f, rcsv.colon_separated)
1140+
reader = csv.reader(f, csv.colon_separated)
11391141
cl.import_journals(reader)
11401142
f.close()
11411143

roundup/cgi/actions.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
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 $
22

33
import re, cgi, StringIO, urllib, Cookie, time, random
44

5-
from roundup import hyperdb, token, date, password, rcsv
5+
from roundup import hyperdb, token, date, password, csv
66
from roundup.i18n import _
77
import roundup.exceptions
88
from roundup.cgi import exceptions, templating
@@ -253,19 +253,14 @@ def handle(self):
253253
removed lines are retired.
254254
255255
"""
256-
# get the CSV module
257-
if rcsv.error:
258-
self.client.error_message.append(self._(rcsv.error))
259-
return
260-
261256
cl = self.db.classes[self.classname]
262257
idlessprops = cl.getprops(protected=0).keys()
263258
idlessprops.sort()
264259
props = ['id'] + idlessprops
265260

266261
# do the edit
267262
rows = StringIO.StringIO(self.form['rows'].value)
268-
reader = rcsv.reader(rows, rcsv.comma_separated)
263+
reader = csv.reader(rows)
269264
found = {}
270265
line = 0
271266
for values in reader:
@@ -946,7 +941,7 @@ def handle(self):
946941
# all done, return a dummy string
947942
return 'dummy'
948943

949-
writer = rcsv.writer(self.client.request.wfile)
944+
writer = csv.writer(self.client.request.wfile)
950945
writer.writerow(columns)
951946

952947
# and search

roundup/cgi/templating.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
import sys, cgi, urllib, os, re, os.path, time, errno, mimetypes
2323

24-
from roundup import hyperdb, date, rcsv, support
24+
from roundup import hyperdb, date, csv, support
2525
from roundup import i18n
2626
from roundup.i18n import _
2727

@@ -569,12 +569,9 @@ def list(self, sort_on=None):
569569
def csv(self):
570570
''' Return the items of this class as a chunk of CSV text.
571571
'''
572-
if rcsv.error:
573-
return rcsv.error
574-
575572
props = self.propnames()
576573
s = StringIO.StringIO()
577-
writer = rcsv.writer(s, rcsv.comma_separated)
574+
writer = csv.writer(s)
578575
writer.writerow(props)
579576
for nodeid in self._klass.list():
580577
l = []

0 commit comments

Comments
 (0)