2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-29 13:21:54 +00:00

Add SURVEX_TOPNAME (top-level survex file) as a setting item in settings.py so it's not hardcoded.

This commit is contained in:
expo on server 2019-06-26 03:32:18 +01:00
parent b42249890e
commit 02d3cc84d5
3 changed files with 8 additions and 5 deletions

View File

@ -97,7 +97,7 @@ class SurvexBlockLookUpManager(models.Manager):
blocknames = [] blocknames = []
else: else:
blocknames = name.split(".") blocknames = name.split(".")
block = SurvexBlock.objects.get(parent=None, survexfile__path="all") block = SurvexBlock.objects.get(parent=None, survexfile__path=settings.SURVEX_TOPNAME)
for blockname in blocknames: for blockname in blocknames:
block = SurvexBlock.objects.get(parent=block, name__iexact=blockname) block = SurvexBlock.objects.get(parent=block, name__iexact=blockname)
return block return block

View File

@ -249,7 +249,7 @@ def LoadAllSurvexBlocks():
print(" - Data flushed") print(" - Data flushed")
survexfile = models.SurvexFile(path="all", cave=None) survexfile = models.SurvexFile(path=settings.SURVEX_TOPNAME, cave=None)
survexfile.save() survexfile.save()
survexfile.SetDirectory() survexfile.SetDirectory()
@ -281,9 +281,9 @@ def LoadPos():
print('Loading Pos....') print('Loading Pos....')
call([settings.CAVERN, "--output=%s/all.3d" % settings.SURVEX_DATA, "%s/all.svx" % settings.SURVEX_DATA]) call([settings.CAVERN, "--output=%s%s.3d" % (settings.SURVEX_DATA, settings.SURVEX_TOPNAME), "%s%s.svx" % (settings.SURVEX_DATA, settings.SURVEX_TOPNAME)])
call([settings.THREEDTOPOS, '%sall.3d' % settings.SURVEX_DATA], cwd = settings.SURVEX_DATA) call([settings.THREEDTOPOS, '%s%s.3d' % (settings.SURVEX_DATA, settings.SURVEX_TOPNAME)], cwd = settings.SURVEX_DATA)
posfile = open("%sall.pos" % settings.SURVEX_DATA) posfile = open("%s%s.pos" % (settings.SURVEX_DATA, settings.SURVEX_TOPNAME))
posfile.readline() #Drop header posfile.readline() #Drop header
for line in posfile.readlines(): for line in posfile.readlines():
r = poslineregex.match(line) r = poslineregex.match(line)

View File

@ -53,6 +53,9 @@ SURVEYS_URL = urlparse.urljoin(URL_ROOT , '/survey_scans/')
PHOTOS_URL = urlparse.urljoin(URL_ROOT , '/photos/') PHOTOS_URL = urlparse.urljoin(URL_ROOT , '/photos/')
SVX_URL = urlparse.urljoin(URL_ROOT , '/survex/') SVX_URL = urlparse.urljoin(URL_ROOT , '/survex/')
# top-level survex file basename (without .svx)
SURVEX_TOPNAME = "1623"
DEFAULT_LOGBOOK_PARSER = "Parseloghtmltxt" DEFAULT_LOGBOOK_PARSER = "Parseloghtmltxt"
DEFAULT_LOGBOOK_FILE = "logbook.html" DEFAULT_LOGBOOK_FILE = "logbook.html"