Steve broke the regex, lame

master
daz 2014-02-03 21:10:02 +01:00
parent 919333e70c
commit 7d95d6ff8e
1 changed files with 8 additions and 6 deletions

View File

@ -21,17 +21,15 @@ def init_pope(meta):
return pope
else:
pope = Pope(meta["id"], meta["name"])
pope.save()
return pope
def add_pope_entry(pope, path):
if pope_or_death(PopeImage, path=path):
print('-', end='')
return False
return None
pope_image = parse_pope(path)
pope_image.pope = pope
pope_image.save()
print('+', end='')
return pope_image
@ -56,11 +54,15 @@ def main():
existing_popes.append(meta["id"])
pope = init_pope(meta)
with open(pl) as file:
pope_images_batch = []
with open(pl, 'rU') as file:
for line in file:
line = line.rstrip()
line = line.rstrip('\n')
line = path.join("popes", line)
add_pope_entry(pope, line)
pope_images_batch.append(
add_pope_entry(pope, line)
)
PopeImage.objects.bulk_create((x for x in pope_images_batch if x is not None))
if __name__ == '__main__':