mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-14 05:55:06 +00:00
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
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user