mirror of
https://github.com/borgbackup/borg.git
synced 2025-01-19 14:02:55 +00:00
ArchiveFormatter.get_meta: add default value argument
This commit is contained in:
parent
09781e1d30
commit
355a50225f
1 changed files with 6 additions and 6 deletions
|
@ -722,10 +722,10 @@ def __init__(self, format, repository, manifest, key, *, json=False, iec=False):
|
||||||
self.format = partial_format(format, static_keys)
|
self.format = partial_format(format, static_keys)
|
||||||
self.format_keys = {f[1] for f in Formatter().parse(format)}
|
self.format_keys = {f[1] for f in Formatter().parse(format)}
|
||||||
self.call_keys = {
|
self.call_keys = {
|
||||||
"hostname": partial(self.get_meta, "hostname"),
|
"hostname": partial(self.get_meta, "hostname", ""),
|
||||||
"username": partial(self.get_meta, "username"),
|
"username": partial(self.get_meta, "username", ""),
|
||||||
"comment": partial(self.get_meta, "comment"),
|
"comment": partial(self.get_meta, "comment", ""),
|
||||||
"command_line": partial(self.get_meta, "command_line"),
|
"command_line": partial(self.get_meta, "command_line", ""),
|
||||||
"end": self.get_ts_end,
|
"end": self.get_ts_end,
|
||||||
}
|
}
|
||||||
self.used_call_keys = set(self.call_keys) & self.format_keys
|
self.used_call_keys = set(self.call_keys) & self.format_keys
|
||||||
|
@ -771,8 +771,8 @@ def archive(self):
|
||||||
self._archive = Archive(self.manifest, self.name, iec=self.iec)
|
self._archive = Archive(self.manifest, self.name, iec=self.iec)
|
||||||
return self._archive
|
return self._archive
|
||||||
|
|
||||||
def get_meta(self, key):
|
def get_meta(self, key, default=None):
|
||||||
return self.archive.metadata.get(key, "")
|
return self.archive.metadata.get(key, default)
|
||||||
|
|
||||||
def get_ts_end(self):
|
def get_ts_end(self):
|
||||||
return self.format_time(self.archive.ts_end)
|
return self.format_time(self.archive.ts_end)
|
||||||
|
|
Loading…
Reference in a new issue