summaryrefslogtreecommitdiffstats
path: root/export
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
parentc8ff8e3ef60c6eba0071e20664268c790c6a6aa6 (diff)
downloadtroggle-dc1327674c2676db02ccf525725019cd9115b699.tar.gz
troggle-dc1327674c2676db02ccf525725019cd9115b699.tar.bz2
troggle-dc1327674c2676db02ccf525725019cd9115b699.zip
remove all the DOS linefeeds
Diffstat (limited to 'export')
-rw-r--r--export/tocavetab.py98
-rw-r--r--export/toqms.py56
2 files changed, 77 insertions, 77 deletions
diff --git a/export/tocavetab.py b/export/tocavetab.py
index bf0170d..f55032d 100644
--- a/export/tocavetab.py
+++ b/export/tocavetab.py
@@ -1,49 +1,49 @@
-import troggle.core.models as models
-from django.conf import settings
-
-import csv, re, os
-
-#format of CAVETAB2.CSV is
-headers=['KatasterNumber','KatStatusCode','Entrances','UnofficialNumber','MultipleEntrances','AutogenFile','LinkFile','LinkEntrance','Name','UnofficialName',
- 'Comment','Area','Explorers','UndergroundDescription','Equipment','QMList','KatasterStatus','References','UndergroundCentreLine','UndergroundDrawnSurvey',
- 'SurvexFile','Length','Depth','Extent','Notes','EntranceName','TagPoint','OtherPoint','DescriptionOfOtherPoint','ExactEntrance','TypeOfFix','GPSpreSA',
- 'GPSpostSA','Northing','Easting','Altitude','Bearings','Map','Location','Approach','EntranceDescription','PhotoOfLocation','Marking','MarkingComment',
- 'Findability','FindabilityComment']
-
-def cavetabRow(cave):
- #mapping of troggle models to table columns is: (guess this could just be a tuple of tuples rather than a dictionary actually)
- columnsToModelFields={
- 'Name':cave.official_name,
- 'Area':cave.kat_area(),
- 'KatStatusCode':cave.kataster_code,
- 'KatasterNumber':cave.kataster_number,
- 'UnofficialNumber':cave.unofficial_number,
- #'' : cave.entrances This is a multiple foreignkey now, may be tricky to dump back into csv. Work on this.
- 'Explorers':cave.explorers,
- 'UndergroundDescription':cave.underground_description,
- 'Equipment':cave.equipment,
- 'References':cave.references,
- 'UndergroundDrawnSurvey':cave.survey,
- 'KatasterStatus':cave.kataster_status,
- 'UndergroundCentreLine':cave.underground_centre_line,
- 'Notes':cave.notes,
- 'Length':cave.length,
- 'Depth':cave.depth,
- 'Extent':cave.extent,
- 'SurvexFile':cave.survex_file,
- }
-
- caveRow=['' 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
- caveRow[headers.index(column)]=modelField.replace(u'\xd7','x').replace(u'\u201c','').replace(u'\u2013','').replace(u'\xbd','')
- return caveRow
-
-def writeCaveTab(outfile):
- cavewriter=csv.writer(outfile,lineterminator='\r')
- cavewriter.writerow(headers)
- for cave in models.Cave.objects.all():
- cavewriter.writerow(cavetabRow(cave))
-
-
+import troggle.core.models as models
+from django.conf import settings
+
+import csv, re, os
+
+#format of CAVETAB2.CSV is
+headers=['KatasterNumber','KatStatusCode','Entrances','UnofficialNumber','MultipleEntrances','AutogenFile','LinkFile','LinkEntrance','Name','UnofficialName',
+ 'Comment','Area','Explorers','UndergroundDescription','Equipment','QMList','KatasterStatus','References','UndergroundCentreLine','UndergroundDrawnSurvey',
+ 'SurvexFile','Length','Depth','Extent','Notes','EntranceName','TagPoint','OtherPoint','DescriptionOfOtherPoint','ExactEntrance','TypeOfFix','GPSpreSA',
+ 'GPSpostSA','Northing','Easting','Altitude','Bearings','Map','Location','Approach','EntranceDescription','PhotoOfLocation','Marking','MarkingComment',
+ 'Findability','FindabilityComment']
+
+def cavetabRow(cave):
+ #mapping of troggle models to table columns is: (guess this could just be a tuple of tuples rather than a dictionary actually)
+ columnsToModelFields={
+ 'Name':cave.official_name,
+ 'Area':cave.kat_area(),
+ 'KatStatusCode':cave.kataster_code,
+ 'KatasterNumber':cave.kataster_number,
+ 'UnofficialNumber':cave.unofficial_number,
+ #'' : cave.entrances This is a multiple foreignkey now, may be tricky to dump back into csv. Work on this.
+ 'Explorers':cave.explorers,
+ 'UndergroundDescription':cave.underground_description,
+ 'Equipment':cave.equipment,
+ 'References':cave.references,
+ 'UndergroundDrawnSurvey':cave.survey,
+ 'KatasterStatus':cave.kataster_status,
+ 'UndergroundCentreLine':cave.underground_centre_line,
+ 'Notes':cave.notes,
+ 'Length':cave.length,
+ 'Depth':cave.depth,
+ 'Extent':cave.extent,
+ 'SurvexFile':cave.survex_file,
+ }
+
+ caveRow=['' 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
+ caveRow[headers.index(column)]=modelField.replace(u'\xd7','x').replace(u'\u201c','').replace(u'\u2013','').replace(u'\xbd','')
+ return caveRow
+
+def writeCaveTab(outfile):
+ cavewriter=csv.writer(outfile,lineterminator='\r')
+ cavewriter.writerow(headers)
+ for cave in models.Cave.objects.all():
+ cavewriter.writerow(cavetabRow(cave))
+
+
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