If obj[%data_key_name] exists, return name of a file with base64 decoded obj[%data_key_name] content otherwise obj[%file_key_name].
(self)
| 111 | os.path.join(file_base_path, obj[file_key_name])) |
| 112 | |
| 113 | def as_file(self): |
| 114 | """If obj[%data_key_name] exists, return name of a file with base64 |
| 115 | decoded obj[%data_key_name] content otherwise obj[%file_key_name].""" |
| 116 | use_data_if_no_file = not self._file and self._data |
| 117 | if use_data_if_no_file: |
| 118 | self._write_file() |
| 119 | |
| 120 | if self._file and not os.path.isfile(self._file): |
| 121 | self._write_file(force_rewrite=True) |
| 122 | if self._file and not os.path.isfile(self._file): |
| 123 | raise ConfigException("File does not exist: %s" % self._file) |
| 124 | return self._file |
| 125 | |
| 126 | def as_data(self): |
| 127 | """If obj[%data_key_name] exists, Return obj[%data_key_name] otherwise |