forked from expo/troggle
todo: parsing caves
This commit is contained in:
parent
9e7414e0e0
commit
e236e792ec
@ -43,6 +43,7 @@ def todos(request, module):
|
|||||||
'''
|
'''
|
||||||
from troggle.core.TESTS.tests import todo as tests
|
from troggle.core.TESTS.tests import todo as tests
|
||||||
from troggle.core.views.logbooks import todo as viewlogbooks
|
from troggle.core.views.logbooks import todo as viewlogbooks
|
||||||
|
from troggle.parsers.caves import todo as parserscaves
|
||||||
from troggle.parsers.logbooks import todo as parserslogbooks
|
from troggle.parsers.logbooks import todo as parserslogbooks
|
||||||
from troggle.parsers.survex import todo as parserssurvex
|
from troggle.parsers.survex import todo as parserssurvex
|
||||||
from troggle.core.models.caves import todo as modelcaves
|
from troggle.core.models.caves import todo as modelcaves
|
||||||
@ -51,6 +52,7 @@ def todos(request, module):
|
|||||||
tododict = {'views/other': todo,
|
tododict = {'views/other': todo,
|
||||||
'tests': tests,
|
'tests': tests,
|
||||||
'views/logbooks': viewlogbooks,
|
'views/logbooks': viewlogbooks,
|
||||||
|
'parsers/caves': parserscaves,
|
||||||
'parsers/logbooks': parserslogbooks,
|
'parsers/logbooks': parserslogbooks,
|
||||||
'parsers/survex': parserssurvex,
|
'parsers/survex': parserssurvex,
|
||||||
'core/models/caves': modelcaves,
|
'core/models/caves': modelcaves,
|
||||||
|
@ -19,6 +19,12 @@ django.db.transaction.TransactionManagementError:
|
|||||||
An error occurred in the current transaction. You can't execute queries until the end of the 'atomic' block.
|
An error occurred in the current transaction. You can't execute queries until the end of the 'atomic' block.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
todo='''- Update does not work when a cave id is in the pending list but a proper cave description file exists
|
||||||
|
and is being imported. It should work. But currently Django aborts and he file is not read in.
|
||||||
|
|
||||||
|
- Cannot use Edit This Page for pendingcaves.txt_edit as Edit This Page is expecting an html file.
|
||||||
|
So we will need a separate file-editing capability just for this configuration file.
|
||||||
|
'''
|
||||||
entrances_xslug = {}
|
entrances_xslug = {}
|
||||||
caves_xslug = {}
|
caves_xslug = {}
|
||||||
areas_xslug = {}
|
areas_xslug = {}
|
||||||
@ -133,7 +139,13 @@ def readcaves():
|
|||||||
'''
|
'''
|
||||||
# For those caves which do not have cave_data/1623-xxx.html XML files even though they exist and have surveys
|
# For those caves which do not have cave_data/1623-xxx.html XML files even though they exist and have surveys
|
||||||
# should put this in a simple list which can be edited using 'Edit this file'
|
# should put this in a simple list which can be edited using 'Edit this file'
|
||||||
pending = settings.PENDING
|
pending = []
|
||||||
|
fpending = Path(settings.CAVEDESCRIPTIONS, "pendingcaves.txt")
|
||||||
|
if fpending.is_file():
|
||||||
|
with open(fpending, "r") as fo:
|
||||||
|
cids = fo.readlines()
|
||||||
|
for cid in cids:
|
||||||
|
pending.append(cid.rstrip('\n'))
|
||||||
|
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
print(" - Deleting Caves and Entrances")
|
print(" - Deleting Caves and Entrances")
|
||||||
@ -372,6 +384,7 @@ def readcave(filename):
|
|||||||
primary = primary)
|
primary = primary)
|
||||||
caves_xslug[slug] = cs
|
caves_xslug[slug] = cs
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
|
# This fails to do an update! It just crashes.. to be fixed
|
||||||
message = " ! Cave update/create failure : %s, skipping file cave_data/%s with exception\nException: %s" % (slug, context, ex.__class__)
|
message = " ! Cave update/create failure : %s, skipping file cave_data/%s with exception\nException: %s" % (slug, context, ex.__class__)
|
||||||
DataIssue.objects.create(parser='caves', message=message)
|
DataIssue.objects.create(parser='caves', message=message)
|
||||||
print(message)
|
print(message)
|
||||||
|
Loading…
Reference in New Issue
Block a user