Changeset 1719 for pykota/trunk/bin

Show
Ignore:
Timestamp:
09/15/04 09:26:20 (20 years ago)
Author:
jalet
Message:

Data dumps are now ordered by entry creation date if applicable.
Now dumpykota exits with a message when there's a broken pipe like
in dumpykota --data history | head -3

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/dumpykota

    r1718 r1719  
    2424# 
    2525# $Log$ 
     26# Revision 1.4  2004/09/15 07:26:19  jalet 
     27# Data dumps are now ordered by entry creation date if applicable. 
     28# Now dumpykota exits with a message when there's a broken pipe like 
     29# in dumpykota --data history | head -3 
     30# 
    2631# Revision 1.3  2004/09/15 06:58:25  jalet 
    2732# User groups membership and printer groups membership can now be dumped too 
     
    125130        entries = getattr(self.storage, "extract%s" % datatype.title())()     
    126131        if entries is not None : 
    127             getattr(self, "dump%s" % format.title())(entries) 
     132            return getattr(self, "dump%s" % format.title())(entries) 
    128133        return 0 
    129134         
     
    132137        for entry in entries : 
    133138            line = separator.join([ '"%s"' % field for field in entry ]) 
    134             print line 
     139            try : 
     140                print line 
     141            except IOError, msg :     
     142                sys.stderr.write("%s : %s\n" % (_("PyKota data dumper failed : I/O error"), msg)) 
     143                return -1 
     144        return 0         
    135145         
    136146    def dumpCsv(self, entries) :     
    137147        """Dumps datas with a comma as the separator.""" 
    138         self.dumpWithSeparator(",", entries) 
     148        return self.dumpWithSeparator(",", entries) 
    139149                            
    140150    def dumpSsv(self, entries) :     
    141151        """Dumps datas with a comma as the separator.""" 
    142         self.dumpWithSeparator(";", entries) 
     152        return self.dumpWithSeparator(";", entries) 
    143153                            
    144154    def dumpTsv(self, entries) :     
    145155        """Dumps datas with a comma as the separator.""" 
    146         self.dumpWithSeparator("\t", entries) 
     156        return self.dumpWithSeparator("\t", entries) 
    147157                            
    148158if __name__ == "__main__" :