Browse Source

fixed issue where is_empty was true wrongly

is_chunk_yaml_marked_empty now uses standard loader to avoid issues with
conversion from str to bool
master
poikilos 9 years ago
committed by Jacob Gustafson
parent
commit
1cdf8abf63
  1. 29
      chunkymap-regen.py

29
chunkymap-regen.py

@ -647,20 +647,25 @@ class MTChunks:
return result return result
def is_chunk_yaml_marked_empty(self, chunk_luid): def is_chunk_yaml_marked_empty(self, chunk_luid):
yaml_path = self.get_chunk_yaml_path(chunk_luid)
result = False result = False
yaml_path = self.get_chunk_yaml_path(chunk_luid)
if os.path.isfile(yaml_path): if os.path.isfile(yaml_path):
ins = open(yaml_path, 'r') self.prepare_chunk_meta(chunk_luid) # DOES get existing data if any file exists
line = True if "is_empty" in self.chunks[chunk_luid].metadata.keys():
while line: result = self.chunks[chunk_luid].metadata["is_empty"]
line = ins.readline()
if line: #if os.path.isfile(yaml_path):
line_strip = line.strip() #ins = open(yaml_path, 'r')
prevalue_string="is_empty:" #line = True
if line_strip[:len(prevalue_string)]==prevalue_string: #while line:
result = bool(line_strip[len(prevalue_string):].strip()) #line = ins.readline()
break #if line:
ins.close() #line_strip = line.strip()
#prevalue_string="is_empty:"
#if line_strip[:len(prevalue_string)]==prevalue_string:
#result = bool(line_strip[len(prevalue_string):].strip())
#break
#ins.close()
return result return result
def remove_chunk_image(self, chunk_luid): def remove_chunk_image(self, chunk_luid):

Loading…
Cancel
Save