summaryrefslogtreecommitdiffstats
path: root/core/models/caves.py
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@gmail.com>2024-07-03 19:27:37 +0300
committerPhilip Sargent <philip.sargent@gmail.com>2024-07-03 19:27:37 +0300
commit1c8c36c82fccead17af96b91720c266600805a8b (patch)
treebf30effad4cfef878ef7b42795343fa0b53ddc85 /core/models/caves.py
parentb6ffcb63bf186e154dbf25d9dce8754c031d7a82 (diff)
downloadtroggle-1c8c36c82fccead17af96b91720c266600805a8b.tar.gz
troggle-1c8c36c82fccead17af96b91720c266600805a8b.tar.bz2
troggle-1c8c36c82fccead17af96b91720c266600805a8b.zip
loading cave aliases from file now working
Diffstat (limited to 'core/models/caves.py')
-rw-r--r--core/models/caves.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/core/models/caves.py b/core/models/caves.py
index c9405ee..4cf0512 100644
--- a/core/models/caves.py
+++ b/core/models/caves.py
@@ -12,7 +12,7 @@ import settings
from troggle.core.models.logbooks import QM
from troggle.core.models.survex import SurvexStation, utmToLatLng
from troggle.core.models.troggle import DataIssue, TroggleModel
-from troggle.core.utils import TROG, writetrogglefile
+from troggle.core.utils import TROG, writetrogglefile, parse_aliases
# Use the TROG global object to cache the cave lookup list. No good for multi-user.., or even multi-page. Pointless in fact.
Gcavelookup = TROG["caves"]["gcavelookup"]
@@ -532,10 +532,19 @@ def GetCaveLookup():
print(cave, cave.slug())
# These might alse create more duplicate entries
- # Yes, this should be set in, and imported from, an easily editable file
+ aliases = []
+ # read the two files in /cave_data/
+ for ca in ["cavealiasesold.txt", "cavealiases.txt"]:
+ pairs, report = parse_aliases(ca)
+ aliases += pairs
+
+ # print(f"Loaded aliases, {len(aliases)} found\n{report}\n {aliases}")
+
# On reset, these aliases only work if the cave already properly exists with an entry in :expoweb:/cave_data/
# but as the aliases are recomputed repeatedly, eventually they work on PENDING caves too
- aliases = [
+
+ # oldaliases are NOT USED. We are reading from the files instead now. Pending deletion..
+ oldaliases = [
("1987-02", "1623-267"),
("1990-01", "1623-171"),
("1990-02", "1623-172"),