summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/models_caves.py4
-rw-r--r--parsers/survex.py9
2 files changed, 8 insertions, 5 deletions
diff --git a/core/models_caves.py b/core/models_caves.py
index 11aa24a..a6b44c7 100644
--- a/core/models_caves.py
+++ b/core/models_caves.py
@@ -203,11 +203,9 @@ class Cave(TroggleModel):
def getCaveByReference(reference):
areaname, code = reference.split("-", 1)
- #print(areaname, code)
area = Area.objects.get(short_name = areaname)
- #print(area)
foundCaves = list(Cave.objects.filter(area = area, kataster_number = code).all()) + list(Cave.objects.filter(area = area, unofficial_number = code).all())
- print((list(foundCaves)))
+ #print((list(foundCaves)))
if len(foundCaves) == 1:
return foundCaves[0]
else:
diff --git a/parsers/survex.py b/parsers/survex.py
index 5f23c5c..ebf1cb0 100644
--- a/parsers/survex.py
+++ b/parsers/survex.py
@@ -162,7 +162,7 @@ def RecursiveLoad(survexblock, survexfile, fin):
global callcount
global survexlegsnumber
- print(insp+" - MEM:{} Reading. parent:{} <> {} ".format(get_process_memory(),survexblock.survexfile.path,survexfile.path))
+ print(insp+" - MEM:{:.3f} Reading. parent:{} <> {} ".format(get_process_memory(),survexblock.survexfile.path,survexfile.path))
stamp = datetime.now()
lineno = 0
@@ -181,6 +181,8 @@ def RecursiveLoad(survexblock, survexfile, fin):
survexfile.cave = cave
svxlines = ''
svxlines = fin.read().splitlines()
+ # cannot close file now as it may be recursively called with the same file id fin if nested *begin
+ # occurs.
for svxline in svxlines:
lineno += 1
# break the line at the comment
@@ -341,20 +343,23 @@ def RecursiveLoad(survexblock, survexfile, fin):
survexblockdown.save()
survexblock.save()
survexblock = survexblockdown
+ print(insp+" - ENTERING nested *begin/*end block: {}".format(name))
insp += "> "
RecursiveLoad(survexblockdown, survexfile, fin)
#--------------------------------------------------------
# do not close the file as there may be more blocks in this one
+ # and it is re-read afresh with every nested begin-end block.
insp = insp[2:]
else:
iblankbegins += 1
elif re.match("end$(?i)", cmd):
if iblankbegins:
+ print(insp+" - RETURNING from nested *begin/*end block: {}".format(line))
iblankbegins -= 1
else:
legsinblock = survexlegsnumber - previousnlegs
- print(insp+"LEGS: {} (previous: {}, now:{})".format(legsinblock,previousnlegs,survexlegsnumber))
+ print(insp+" - LEGS: {} (previous: {}, now:{})".format(legsinblock,previousnlegs,survexlegsnumber))
survexblock.legsall = legsinblock
survexblock.save()
endstamp = datetime.now()