"""Read a file and create elements accordingly."""
self.modified = False
try:
- self.data = yaml.load(open(self.filename))
+ self.data = yaml.safe_load(open(self.filename))
except FileNotFoundError:
# it's normal if the file is one which doesn't exist yet
log_entry = ("File %s is unavailable." % self.filename, 6)
os.umask(old_umask)
# write and close the file
- yaml.dump(self.data, allow_unicode=True, default_flow_style=False,
- stream=file_descriptor)
+ yaml.safe_dump(self.data, allow_unicode=True,
+ default_flow_style=False, stream=file_descriptor)
file_descriptor.close()
# unset the modified flag