diff options
author | Philip Sargent <philip.sargent@gmail.com> | 2023-09-06 22:58:14 +0300 |
---|---|---|
committer | Philip Sargent <philip.sargent@gmail.com> | 2023-09-06 22:58:14 +0300 |
commit | 69340db43874d1ed9a2c4d27595c090016dc4c55 (patch) | |
tree | cc485c7dfb63b0ae3929b93354d1a552c4fbbd80 /parsers/survex.py | |
parent | 1ddb8248dff14b819c0037b9f59d68aedeba9829 (diff) | |
download | troggle-69340db43874d1ed9a2c4d27595c090016dc4c55.tar.gz troggle-69340db43874d1ed9a2c4d27595c090016dc4c55.tar.bz2 troggle-69340db43874d1ed9a2c4d27595c090016dc4c55.zip |
SurvexDirectory removed from active code
Diffstat (limited to 'parsers/survex.py')
-rw-r--r-- | parsers/survex.py | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/parsers/survex.py b/parsers/survex.py index e802a79..2339fbc 100644 --- a/parsers/survex.py +++ b/parsers/survex.py @@ -10,7 +10,7 @@ from pathlib import Path import troggle.settings as settings from troggle.core.models.caves import Cave, Entrance, GetCaveLookup from troggle.core.models.logbooks import QM -from troggle.core.models.survex import SurvexBlock, SurvexDirectory, SurvexFile, SurvexPersonRole, SurvexStation +from troggle.core.models.survex import SurvexBlock, SurvexFile, SurvexPersonRole, SurvexStation from troggle.core.models.wallets import Wallet from troggle.core.models.troggle import DataIssue, Expedition from troggle.core.utils import chaosmonkey, get_process_memory @@ -2137,7 +2137,8 @@ def FindAndLoadSurvex(survexblockroot): svx_scan = LoadingSurvex() svx_scan.callcount = 0 svx_scan.depthinclude = 0 - fullpathtotop = os.path.join(survexfileroot.survexdirectory.path, survexfileroot.path) + #fullpathtotop = os.path.join(survexfileroot.survexdirectory.path, survexfileroot.path) + fullpathtotop = str(Path(survexfileroot.path).parent / survexfileroot.path) print(f" - RunSurvexIfNeeded cavern on '{fullpathtotop}'", file=sys.stderr) svx_scan.RunSurvexIfNeeded(fullpathtotop, fullpathtotop) @@ -2254,7 +2255,7 @@ def FindAndLoadSurvex(survexblockroot): omit_scan = LoadingSurvex() omit_scan.callcount = 0 omit_scan.depthinclude = 0 - fullpathtotop = os.path.join(survexfileroot.survexdirectory.path, UNSEENS) + fullpathtotop = str(Path(settings.SURVEX_DATA, UNSEENS)) # copy the list to prime the next pass through the files omit_scan.svxfileslist = svx_scan.svxfileslist[:] @@ -2363,7 +2364,7 @@ def display_contents(blocks): for sf in sfs: print(f" SF {sf}") # print(f" SD {sf.survexdirectory} {sf.survexdirectory.cave}") - print(f" SD {sf.survexdirectory} {sf.survexdirectory.path}") + #print(f" SD {sf.survexdirectory} {sf.survexdirectory.path}") ws = Wallet.objects.filter(survexblock=b) for w in ws: @@ -2511,12 +2512,12 @@ def MakeSurvexFileRoot(): fileroot = SurvexFile(path=settings.SURVEX_TOPNAME, cave=None) fileroot.save() - directoryroot = SurvexDirectory(path=settings.SURVEX_DATA, primarysurvexfile=fileroot) + #directoryroot = SurvexDirectory(path=settings.SURVEX_DATA, primarysurvexfile=fileroot) # MariaDB doesn't like this hack. Complains about non-null cave_id EVEN THOUGH our model file says this is OK: # cave = models.ForeignKey('Cave', blank=True, null=True,on_delete=models.SET_NULL) - directoryroot.save() - fileroot.survexdirectory = directoryroot # i.e. SURVEX_DATA/SURVEX_TOPNAME - fileroot.save() # mutually dependent objects need a double-save like this + #directoryroot.save() + #fileroot.survexdirectory = directoryroot # i.e. SURVEX_DATA/SURVEX_TOPNAME + #fileroot.save() # mutually dependent objects need a double-save like this return fileroot @@ -2532,10 +2533,10 @@ def MakeFileRoot(fn): print(f" - Making/finding a new root survexfile for this import: {fn}") fileroot = SurvexFile(path=fn, cave=cave) - try: - fileroot.survexdirectory = SurvexDirectory.objects.get(id=1) # default - except: - fileroot.survexdirectory = None + # try: + # fileroot.survexdirectory = SurvexDirectory.objects.get(id=1) # default + # except: + # fileroot.survexdirectory = None # if cave: @@ -2566,7 +2567,6 @@ def LoadSurvexBlocks(): # https://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.ForeignKey.on_delete SurvexBlock.objects.all().delete() SurvexFile.objects.all().delete() - SurvexDirectory.objects.all().delete() SurvexPersonRole.objects.all().delete() SurvexStation.objects.all().delete() mem1 = get_process_memory() |