Beispiel #1
0
    def convert(self, edit):
        """Convert the read data to the desired format."""

        errors = False
        try:
            # Convert Python dict to PLIST buffer
            self.output = json.json_dumps(
                self.yaml,
                preserve_binary=self.settings.get("json_preserve_binary_data", True)
            )
            self.yaml = None
        except Exception:
            errors = True
            error_msg(self.errors["yaml2json"], traceback.format_exc())
        return errors
Beispiel #2
0
    def convert(self, edit):
        """Convert the read data to the desired format."""

        errors = False
        try:
            if not errors:
                self.output = json.json_dumps(
                    self.plist,
                    preserve_binary=self.settings.get("json_preserve_binary_data", True)
                )
                self.plist = None
        except Exception:
            errors = True
            error_type = 'bplist2json' if self.binary else 'plist2json'
            error_msg(self.errors[error_type], traceback.format_exc())
        return errors