aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2009-07-21 22:54:27 +0000
committerRob Austein <sra@hactrn.net>2009-07-21 22:54:27 +0000
commit09d03d70a4ecd6d6c1b738c11092422ffff66777 (patch)
tree108ee3aafa950b3c18de755e5aedf98df0340a88
parent7220c449cf2074c82a5dc6c485bd8685d69579db (diff)
Move CSV dialect parameters out to where it's easier to see them and
customize them if necessary. svn path=/myrpki/myrpki.py; revision=2658
-rw-r--r--myrpki/myrpki.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/myrpki/myrpki.py b/myrpki/myrpki.py
index c45a59ca..dbe72b10 100644
--- a/myrpki/myrpki.py
+++ b/myrpki/myrpki.py
@@ -53,10 +53,19 @@ import subprocess, csv, re, os, getopt, sys, ConfigParser, base64
from xml.etree.ElementTree import Element, SubElement, ElementTree
-# our XML namespace.
+# Our XML namespace.
namespace = "http://www.hactrn.net/uris/rpki/myrpki/"
+# Dialect parameters for our use of CSV files, here to make them easy
+# to change if your site needs to do something different. See doc for
+# the csv module in the Python standard libraries for details if you
+# need to customize these.
+
+csv_delimiter = "\t"
+csv_dialect = None
+
+
class comma_set(set):
"""
Minor customization of set(), to provide a print syntax.
@@ -289,13 +298,13 @@ class parents(dict):
service_uri = service_uri, bpki_cms_certificate = xcert(parent_cms_pemfile), bpki_https_certificate = xcert(parent_https_pemfile))
return self
-def csv_open(filename, delimiter = "\t", dialect = None):
+def csv_open(filename):
"""
Open a CSV file, with settings that make it a tab-delimited file.
You may need to tweak this function for your environment, see the
csv module in the Python standard libraries for details.
"""
- return csv.reader(open(filename, "rb"), dialect = dialect, delimiter = delimiter)
+ return csv.reader(open(filename, "rb"), dialect = csv_dialect, delimiter = csv_delimiter)
def PEMElement(e, tag, filename):
"""