diff options
author | Sam Wenham <sam@wenhams.co.uk> | 2019-02-24 13:03:34 +0000 |
---|---|---|
committer | Sam Wenham <sam@wenhams.co.uk> | 2019-02-24 13:03:34 +0000 |
commit | 8f66837f6fb5b74ba3166ae6e31328f8a9e68d96 (patch) | |
tree | f5683df0d04d8decad0685198e6e76980e376ef0 /parsers/caves.py | |
parent | 670559ec8722d8f2f5c97e93bbed1f610cc67206 (diff) | |
download | troggle-8f66837f6fb5b74ba3166ae6e31328f8a9e68d96.tar.gz troggle-8f66837f6fb5b74ba3166ae6e31328f8a9e68d96.tar.bz2 troggle-8f66837f6fb5b74ba3166ae6e31328f8a9e68d96.zip |
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
Diffstat (limited to 'parsers/caves.py')
-rw-r--r-- | parsers/caves.py | 16 |
1 files changed, 8 insertions, 8 deletions
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 <Slug> <Filename>" 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)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 |