summaryrefslogtreecommitdiffstats
path: root/parsers/caves.py
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@klebos.com>2022-07-21 21:01:57 +0300
committerPhilip Sargent <philip.sargent@klebos.com>2022-07-21 21:01:57 +0300
commitce7dfd65101bb412345c7e287655fdc434cd4623 (patch)
tree7e5aa478d24902c8028367bc91e644aa61f78d86 /parsers/caves.py
parent312ecdcfe15848e612bb782b66f3ff31b349c4e1 (diff)
downloadtroggle-ce7dfd65101bb412345c7e287655fdc434cd4623.tar.gz
troggle-ce7dfd65101bb412345c7e287655fdc434cd4623.tar.bz2
troggle-ce7dfd65101bb412345c7e287655fdc434cd4623.zip
working on MariaDB crash on server
Diffstat (limited to 'parsers/caves.py')
-rw-r--r--parsers/caves.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/parsers/caves.py b/parsers/caves.py
index 91f353a..feb0f83 100644
--- a/parsers/caves.py
+++ b/parsers/caves.py
@@ -12,6 +12,9 @@ from troggle.core.models.caves import Area, Cave, Entrance, CaveSlug, EntranceSl
'''Reads all the cave description data by parsing the xml files (stored as e.g. :EXPOWEB:/cave_data/1623-161.html )
and creating the various Cave, Entrance and necessary Area objects.
+This is the first import that happens after the dabase is reinitialised.
+So is the first thing that creates tables.
+
BUT in Django 2.0 and later we cannot do any queries on data we have just entered
because this is all happening inside one transaction. Bummer.
@@ -184,8 +187,12 @@ def readcaves():
print(" - Creating Areas 1623 and 1626")
# This crashes on the server with MariaDB even though a null parent is explicitly allowed.
- area_1623= Area.objects.create(short_name = "1623")
- area_1626= Area.objects.create(short_name = "1626")
+ area_1623= Area.objects.create(short_name = "1623", parent=None)
+ print(" - Saving Area 1623")
+ area_1623.save()
+ area_1626= Area.objects.create(short_name = "1626", parent=None)
+ print(" - Saving Area 1626")
+ area_1626.save()
print (" - Setting pending caves")
# Do this first, so that these empty entries are overwritten as they get properly created.