Make sure that cave parser only reads .html files in cave_data dir (to stop foo~ causing 'duplicate cave' error)

This commit is contained in:
expoonserver 2018-06-18 23:17:05 +01:00
parent 01f17dc1cc
commit b4d3cb514c

View File

@ -14,10 +14,11 @@ def readcaves():
#print "list of <Slug> <Filename>" #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 for filename in os.walk(settings.ENTRANCEDESCRIPTIONS).next()[2]: #Should be a better way of getting a list of files
if filename.endswith('.html'): if filename.endswith('.html'):
readentrance(filename) 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 for filename in os.walk(settings.CAVEDESCRIPTIONS).next()[2]: #Should be a better way of getting a list of files
readcave(filename) if filename.endswith('.html'):
readcave(filename)
def readentrance(filename): def readentrance(filename):
with open(os.path.join(settings.ENTRANCEDESCRIPTIONS, filename)) as f: with open(os.path.join(settings.ENTRANCEDESCRIPTIONS, filename)) as f: