Skip to content

Commit b748a56

Browse files
author
Richard Jones
committed
merge removal of rcsv
1 parent 39b1b6f commit b748a56

File tree

4 files changed

+18
-103
lines changed

4 files changed

+18
-103
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.86 2004-12-08 03:18:46 richard Exp $
19+
# $Id: admin.py,v 1.87 2005-02-15 00:23:30 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
@@ -1040,8 +1040,6 @@ def do_export(self, args):
10401040
# grab the directory to export to
10411041
if len(args) < 1:
10421042
raise UsageError, _('Not enough arguments supplied')
1043-
if rcsv.error:
1044-
raise UsageError, _(rcsv.error)
10451043

10461044
dir = args[-1]
10471045

@@ -1051,12 +1049,15 @@ def do_export(self, args):
10511049
else:
10521050
classes = self.db.classes.keys()
10531051

1052+
class colon_separated(csv.excel):
1053+
delimiter = ':'
1054+
10541055
# do all the classes specified
10551056
for classname in classes:
10561057
cl = self.get_class(classname)
10571058

10581059
f = open(os.path.join(dir, classname+'.csv'), 'w')
1059-
writer = rcsv.writer(f, rcsv.colon_separated)
1060+
writer = csv.writer(f, colon_separated)
10601061

10611062
properties = cl.getprops()
10621063
propnames = cl.export_propnames()
@@ -1075,7 +1076,7 @@ def do_export(self, args):
10751076

10761077
# export the journals
10771078
jf = open(os.path.join(dir, classname+'-journals.csv'), 'w')
1078-
journals = rcsv.writer(jf, rcsv.colon_separated)
1079+
journals = csv.writer(jf, colon_separated)
10791080
map(journals.writerow, cl.export_journals())
10801081
jf.close()
10811082
return 0
@@ -1102,13 +1103,14 @@ def do_import(self, args):
11021103
'''
11031104
if len(args) < 1:
11041105
raise UsageError, _('Not enough arguments supplied')
1105-
if rcsv.error:
1106-
raise UsageError, _(rcsv.error)
11071106
from roundup import hyperdb
11081107

11091108
# directory to import from
11101109
dir = args[0]
11111110

1111+
class colon_separated(csv.excel):
1112+
delimiter = ':'
1113+
11121114
# import all the files
11131115
for file in os.listdir(dir):
11141116
classname, ext = os.path.splitext(file)
@@ -1120,7 +1122,7 @@ def do_import(self, args):
11201122

11211123
# ensure that the properties and the CSV file headings match
11221124
f = open(os.path.join(dir, file), 'rU')
1123-
reader = rcsv.reader(f, rcsv.colon_separated)
1125+
reader = csv.reader(f, csv.colon_separated)
11241126
file_props = None
11251127
maxid = 1
11261128
# loop through the file and create a node for each entry
@@ -1138,7 +1140,7 @@ def do_import(self, args):
11381140

11391141
# import the journals
11401142
f = open(os.path.join(args[0], classname + '-journals.csv'), 'rU')
1141-
reader = rcsv.reader(f, rcsv.colon_separated)
1143+
reader = csv.reader(f, csv.colon_separated)
11421144
cl.import_journals(reader)
11431145
f.close()
11441146

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.44 2005-02-13 22:04:31 richard Exp $
1+
#$Id: actions.py,v 1.45 2005-02-15 00:23:30 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

@@ -575,12 +575,9 @@ def list(self, sort_on=None):
575575
def csv(self):
576576
''' Return the items of this class as a chunk of CSV text.
577577
'''
578-
if rcsv.error:
579-
return rcsv.error
580-
581578
props = self.propnames()
582579
s = StringIO.StringIO()
583-
writer = rcsv.writer(s, rcsv.comma_separated)
580+
writer = csv.writer(s)
584581
writer.writerow(props)
585582
for nodeid in self._klass.list():
586583
l = []

roundup/rcsv.py

Lines changed: 0 additions & 79 deletions
This file was deleted.

0 commit comments

Comments
 (0)