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
2525import 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
2727from roundup import __version__ as roundup_version
2828import roundup .instance
2929from 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
0 commit comments