summaryrefslogtreecommitdiffstats
path: root/export/toqms.py
diff options
context:
space:
mode:
authorWookey <wookey@wookware.org>2011-07-11 02:10:22 +0100
committerWookey <wookey@wookware.org>2011-07-11 02:10:22 +0100
commitdc1327674c2676db02ccf525725019cd9115b699 (patch)
tree8b3a151a8512576ccfb6bb6578fe124c033c46c0 /export/toqms.py
parentc8ff8e3ef60c6eba0071e20664268c790c6a6aa6 (diff)
downloadtroggle-dc1327674c2676db02ccf525725019cd9115b699.tar.gz
troggle-dc1327674c2676db02ccf525725019cd9115b699.tar.bz2
troggle-dc1327674c2676db02ccf525725019cd9115b699.zip
remove all the DOS linefeeds
Diffstat (limited to 'export/toqms.py')
-rw-r--r--export/toqms.py56
1 files changed, 28 insertions, 28 deletions
diff --git a/export/toqms.py b/export/toqms.py
index a6a264a..2564094 100644
--- a/export/toqms.py
+++ b/export/toqms.py
@@ -1,16 +1,16 @@
-import troggle.core.models as models
-from django.conf import settings
-
-import csv
-import re
-import os
-
-#format of QM tables
-headers=['Number','Grade','Area','Description','Page reference','Nearest station','Completion description','Comment']
-
-def qmRow(qm):
- #mapping of troggle models to table columns is: (guess this could just be a tuple of tuples rather than a dictionary actually)
- columnsToModelFields={
+import troggle.core.models as models
+from django.conf import settings
+
+import csv
+import re
+import os
+
+#format of QM tables
+headers=['Number','Grade','Area','Description','Page reference','Nearest station','Completion description','Comment']
+
+def qmRow(qm):
+ #mapping of troggle models to table columns is: (guess this could just be a tuple of tuples rather than a dictionary actually)
+ columnsToModelFields={
'Number':str(qm.number),
'Grade':qm.grade,
'Area':qm.area,
@@ -18,19 +18,19 @@ def qmRow(qm):
#'Page reference': #not implemented
'Nearest station':qm.nearest_station_description,
'Completion description':qm.completion_description,
- 'Comment':qm.comment
- }
-
- qmRow=['' for x in range(len(headers))]
- for column, modelField in columnsToModelFields.items():
- if modelField:
- # Very sorry about the atrocious replace below. I will fix this soon if noone beats me to it. - AC
- qmRow[headers.index(column)]=modelField.replace(u'\xd7','x').replace(u'\u201c','').replace(u'\u2013','').replace(u'\xbd','')
- return qmRow
-
-def writeQmTable(outfile,cave):
- cavewriter=csv.writer(outfile,lineterminator='\r')
- cavewriter.writerow(headers)
- for qm in cave.get_QMs():
- cavewriter.writerow(qmRow(qm))
+ 'Comment':qm.comment
+ }
+
+ qmRow=['' for x in range(len(headers))]
+ for column, modelField in columnsToModelFields.items():
+ if modelField:
+ # Very sorry about the atrocious replace below. I will fix this soon if noone beats me to it. - AC
+ qmRow[headers.index(column)]=modelField.replace(u'\xd7','x').replace(u'\u201c','').replace(u'\u2013','').replace(u'\xbd','')
+ return qmRow
+
+def writeQmTable(outfile,cave):
+ cavewriter=csv.writer(outfile,lineterminator='\r')
+ cavewriter.writerow(headers)
+ for qm in cave.get_QMs():
+ cavewriter.writerow(qmRow(qm))
\ No newline at end of file