def get_format(image):
format = getattr(image, "disk_format", "")
# The "container_format" attribute can actually be set to None,
# which will raise an error if you call upper() on it.
if not format:
return format
if format == "raw":
if getattr(image, "container_format") == 'docker':
return pgettext_lazy("Image format for display in table",
u"Docker")
# Most image formats are untranslated acronyms, but raw is a word
# and should be translated
return pgettext_lazy("Image format for display in table", u"Raw")
return format.upper()
评论列表
文章目录