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
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
@@ -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
0 commit comments