From 4ad5b684333bfb995160cd6bf00308d9f3839d4a Mon Sep 17 00:00:00 2001 From: Sam Wenham Date: Sun, 24 Feb 2019 13:03:34 +0000 Subject: Make things more compatiable with newer python Fix the expeditions list Improvements to make it compatiable with django 1.8 Bump the years to add 2018 Update the .hgignore file to ignore junk --- parsers/caves.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'parsers/caves.py') diff --git a/parsers/caves.py b/parsers/caves.py index 63c9f94..ba1c358 100644 --- a/parsers/caves.py +++ b/parsers/caves.py @@ -10,12 +10,12 @@ def readcaves(): newArea.save() newArea = models.Area(short_name = "1626", parent = None) newArea.save() - print "Reading Entrances" + print("Reading Entrances") #print "list of " for filename in os.walk(settings.ENTRANCEDESCRIPTIONS).next()[2]: #Should be a better way of getting a list of files if filename.endswith('.html'): readentrance(filename) - print "Reading Caves" + print ("Reading Caves") for filename in os.walk(settings.CAVEDESCRIPTIONS).next()[2]: #Should be a better way of getting a list of files if filename.endswith('.html'): readcave(filename) @@ -154,7 +154,7 @@ def readcave(filename): primary = primary) cs.save() except: - print "Can't find text (slug): %s, skipping %s" % (slug, context) + print("Can't find text (slug): %s, skipping %s" % (slug, context)) primary = False for entrance in entrances: @@ -165,17 +165,17 @@ def readcave(filename): ce = models.CaveAndEntrance(cave = c, entrance_letter = letter, entrance = entrance) ce.save() except: - print "Entrance text (slug) %s missing %s" % (slug, context) + print ("Entrance text (slug) %s missing %s" % (slug, context)) def getXML(text, itemname, minItems = 1, maxItems = None, printwarnings = True, context = ""): items = re.findall("<%(itemname)s>(.*?)" % {"itemname": itemname}, text, re.S) if len(items) < minItems and printwarnings: - print "%(count)i %(itemname)s found, at least %(min)i expected" % {"count": len(items), + print("%(count)i %(itemname)s found, at least %(min)i expected" % {"count": len(items), "itemname": itemname, - "min": minItems} + context + "min": minItems} + context) if maxItems is not None and len(items) > maxItems and printwarnings: - print "%(count)i %(itemname)s found, no more than %(max)i expected" % {"count": len(items), + print("%(count)i %(itemname)s found, no more than %(max)i expected" % {"count": len(items), "itemname": itemname, - "max": maxItems} + context + "max": maxItems} + context) return items -- cgit v1.2.3