mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-25 00:31:55 +00:00
caves, scans, survex work in databaseRest
This commit is contained in:
parent
4a51de95c4
commit
2c469718f6
@ -25,6 +25,8 @@ rx_line_length = re.compile(r"[\d\-+.]+$")
|
|||||||
survexlegsalllength = 0.0
|
survexlegsalllength = 0.0
|
||||||
survexlegsnumber = 0
|
survexlegsnumber = 0
|
||||||
survexblockroot = None
|
survexblockroot = None
|
||||||
|
ROOTBLOCK = "rootblock"
|
||||||
|
|
||||||
|
|
||||||
def LoadSurvexLineLeg(survexblock, stardata, sline, comment, cave):
|
def LoadSurvexLineLeg(survexblock, stardata, sline, comment, cave):
|
||||||
global survexlegsalllength
|
global survexlegsalllength
|
||||||
@ -460,7 +462,7 @@ def LoadAllSurvexBlocks():
|
|||||||
|
|
||||||
#Load all
|
#Load all
|
||||||
# this is the first so id=1
|
# this is the first so id=1
|
||||||
survexblockroot = models_survex.SurvexBlock(name="rootblock", survexpath="", cave=None, survexfile=survexfile,
|
survexblockroot = models_survex.SurvexBlock(name=ROOTBLOCK, survexpath="", cave=None, survexfile=survexfile,
|
||||||
legsall=0, legssplay=0, legssurfc=0, totalleglength=0.0)
|
legsall=0, legssplay=0, legssurfc=0, totalleglength=0.0)
|
||||||
survexblockroot.save()
|
survexblockroot.save()
|
||||||
fin = survexfile.OpenFile()
|
fin = survexfile.OpenFile()
|
||||||
@ -556,7 +558,16 @@ def LoadPos():
|
|||||||
posfile = open("%s.pos" % (topdata))
|
posfile = open("%s.pos" % (topdata))
|
||||||
posfile.readline() #Drop header
|
posfile.readline() #Drop header
|
||||||
|
|
||||||
survexblockroot = models_survex.SurvexBlock.objects.get(id=1)
|
try:
|
||||||
|
survexblockroot = models_survex.SurvexBlock.objects.get(name=ROOTBLOCK)
|
||||||
|
except:
|
||||||
|
try:
|
||||||
|
survexblockroot = models_survex.SurvexBlock.objects.get(id=1)
|
||||||
|
except:
|
||||||
|
message = ' ! FAILED to find root SurvexBlock'
|
||||||
|
print(message)
|
||||||
|
models.DataIssue.objects.create(parser='survex', message=message)
|
||||||
|
raise
|
||||||
for line in posfile.readlines():
|
for line in posfile.readlines():
|
||||||
r = poslineregex.match(line)
|
r = poslineregex.match(line)
|
||||||
if r:
|
if r:
|
||||||
|
1
utils.py
1
utils.py
@ -45,6 +45,7 @@ def save_carefully(objectType, lookupAttribs={}, nonLookupAttribs={}):
|
|||||||
defined in core.models.TroggleModel.
|
defined in core.models.TroggleModel.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
print(" !! - SAVE CAREFULLY Django 1.11.29 ", objectType)
|
||||||
instance, created = objectType.objects.get_or_create(defaults=nonLookupAttribs, **lookupAttribs)
|
instance, created = objectType.objects.get_or_create(defaults=nonLookupAttribs, **lookupAttribs)
|
||||||
|
|
||||||
if not created and not instance.new_since_parsing:
|
if not created and not instance.new_since_parsing:
|
||||||
|
Loading…
Reference in New Issue
Block a user