summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
e4630c4)
* lib/mudpy/data.py(DataFile.is_writeable): Add support for determining
read-only status of YAML data files.
# unset the modified flag
self.modified = False
# unset the modified flag
self.modified = False
- # TODO(fungi): this should support writing YAML
def is_writeable(self):
"""Returns True if the __control__ read_only is False."""
def is_writeable(self):
"""Returns True if the __control__ read_only is False."""
- return not self.data.has_option(
- "__control__", "read_only"
- ) or not self.data.getboolean(
- "__control__", "read_only"
- )
+ # TODO(fungi): remove this indirection after the YAML transition
+ if self._format == "yaml":
+ try:
+ return not self.data["__control__"].get("read_only", False)
+ except KeyError:
+ return True
+ else:
+ return not self.data.has_option(
+ "__control__", "read_only"
+ ) or not self.data.getboolean(
+ "__control__", "read_only"
+ )