aboutsummaryrefslogtreecommitdiff
path: root/rpkid/rpki/csv_utils.py
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2012-08-27 22:39:35 +0000
committerRob Austein <sra@hactrn.net>2012-08-27 22:39:35 +0000
commit884a764bbb9d519cf492a33121e01d334a0a53d7 (patch)
tree8bef48138881ae1d53a0e374adece75816e98258 /rpkid/rpki/csv_utils.py
parent49463eed400197bb0e0a53a66ea0f438f515a029 (diff)
Move root.cer to separate rsync module when building test
configurations, to avoid warnings about it being tainted. This is really a conflict between needing to support rootd and wanting to make the configuration clean when not running rootd: either we add an extra directory level to the publication structure which we don't use when not running rootd, or we move root.cer somewhere else. Since the latter is simpler except for test configurations which are already generated for us by programs, we do the latter. svn path=/branches/tk274/; revision=4667
Diffstat (limited to 'rpkid/rpki/csv_utils.py')
-rw-r--r--rpkid/rpki/csv_utils.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/rpkid/rpki/csv_utils.py b/rpkid/rpki/csv_utils.py
index f7eed414..352aebd9 100644
--- a/rpkid/rpki/csv_utils.py
+++ b/rpkid/rpki/csv_utils.py
@@ -68,6 +68,12 @@ class csv_reader(object):
fields += tuple(None for i in xrange(self.columns - len(fields)))
yield fields
+ def __enter__(self):
+ return self
+
+ def __exit__(self, type, value, traceback):
+ self.file.close()
+
class csv_writer(object):
"""
Writer object for tab delimited text. We just use the stock CSV
@@ -83,6 +89,12 @@ class csv_writer(object):
self.file = open(self.renmwo, "w")
self.writer = csv.writer(self.file, dialect = csv.get_dialect("excel-tab"))
+ def __enter__(self):
+ return self
+
+ def __exit__(self, type, value, traceback):
+ self.close()
+
def close(self):
"""
Close this writer.