summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/TESTS/test_imports.py1
-rw-r--r--core/views/other.py1
-rw-r--r--databaseReset.py13
-rw-r--r--logbooksdump.py66
4 files changed, 0 insertions, 81 deletions
diff --git a/core/TESTS/test_imports.py b/core/TESTS/test_imports.py
index 672f581..9edd5c5 100644
--- a/core/TESTS/test_imports.py
+++ b/core/TESTS/test_imports.py
@@ -67,7 +67,6 @@ class SimpleTest(SimpleTestCase):
def test_import_parsers_mix(self):
from troggle.parsers.logbooks import GetCaveLookup
import troggle.settings
- import troggle.logbooksdump
import troggle.parsers.caves
import troggle.parsers.people
import troggle.parsers.drawings
diff --git a/core/views/other.py b/core/views/other.py
index 6f06ecf..56ad5a4 100644
--- a/core/views/other.py
+++ b/core/views/other.py
@@ -32,7 +32,6 @@ todo = '''
so this is only a tool for a first pass, to be followed by extensive hand-editing!
When we have done all the old logbooks, delete this function and the two templates.
-- But how does this interact with troggle/logbooksdump.py ?
'''
def todos(request, module):
diff --git a/databaseReset.py b/databaseReset.py
index bde040c..c2a0d9b 100644
--- a/databaseReset.py
+++ b/databaseReset.py
@@ -47,7 +47,6 @@ from troggle.core.utils import get_process_memory
from troggle.core.models.caves import Cave, Entrance
from troggle.parsers.imports import import_caves, import_people, import_surveyscans, \
import_logbooks, import_QMs, import_survex, import_loadpos, import_drawingsfiles
-import troggle.logbooksdump
if os.geteuid() == 0:
# This protects the server from having the wrong file permissions written on logs and caches
@@ -157,18 +156,6 @@ def memdumpsql(fn):
return True
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# These functions moved to a different file - not used currently.
-# import logbooksdump
-# def dumplogbooks():
-
-# def writeCaves():
- # Writes out all cave and entrance HTML files to
- # folder specified in settings.CAVEDESCRIPTIONS
-# for cave in Cave.objects.all():
-# cave.writeDataFile()
-# for entrance in Entrance.objects.all():
-# entrance.writeDataFile()
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
class JobQueue():
"""A list of import operations to run. Always reports profile times
diff --git a/logbooksdump.py b/logbooksdump.py
deleted file mode 100644
index 877a1d8..0000000
--- a/logbooksdump.py
+++ /dev/null
@@ -1,66 +0,0 @@
-import os
-import time
-import timeit
-
-import settings
-"""currently unused function. To be re-engineered to produce a logbook file
-in canonical post-2010 Parseloghtmltxt() format after importing from one of the
-older more artisanal formats which will then be retired. For example, 2003 used
-a unique HTML format and we should regularise this and deprecate the unique parser
-code Parseloghtml03().
-"""
-os.environ['PYTHONPATH'] = settings.PYTHON_PATH
-os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'settings')
-
-from django.core import management
-from django.db import connection, close_old_connections
-from django.contrib.auth.models import User
-from django.http import HttpResponse
-from django.urls import reverse
-
-from troggle.core.models.caves import Cave, Entrance
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-#Temporary function until definitive source of data transfered.
-from django.template.defaultfilters import slugify
-from django.template import loader
-def dumplogbooks():
- '''This appears to take all the LBEs in the database and to write them all out as infividual html files
- so that they can be re-imported.
- This is the sort of silly thing you have to do when you started out thinking that the database was
- going to be the Source Of All Truth and then retrofitting to make inthe input files be the master.
-
- To be rewritten to produce a single logbook.html in a modern format
- '''
- def get_name(pe):
- if pe.nickname:
- return pe.nickname
- else:
- return pe.person.first_name
- for lbe in troggle.core.models.LogbookEntry.objects.all():
- dateStr = lbe.date.strftime("%Y-%m-%d")
- directory = os.path.join(settings.EXPOWEB,
- "years",
- lbe.expedition.year,
- "autologbook")
- if not os.path.isdir(directory):
- os.mkdir(directory)
- filename = os.path.join(directory,
- dateStr + "." + slugify(lbe.title)[:50] + ".html")
- if lbe.cave:
- print((lbe.cave.reference()))
- trip = {"title": lbe.title, "html":lbe.text, "cave": lbe.cave.reference(), "caveOrLocation": "cave"}
- else:
- trip = {"title": lbe.title, "html":lbe.text, "location":lbe.place, "caveOrLocation": "location"}
- pts = [pt for pt in lbe.persontrip_set.all() if pt.personexpedition]
- persons = [{"name": get_name(pt.personexpedition), "TU": pt.time_underground, "author": pt.is_logbook_entry_author} for pt in pts]
- f = open(filename, "wb")
- template = loader.get_template('dataformat/logbookentry.html')
- context = {'trip': trip,
- 'persons': persons,
- 'date': dateStr,
- 'expeditionyear': lbe.expedition.year}
- output = template.render(context)
- f.write(str(output).encode( "utf-8" ))
- f.close()
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -