From 0a0680496f39c019e92dd69ffedb1ef53bb92b68 Mon Sep 17 00:00:00 2001 From: David Lehman Date: Thu, 28 Feb 2013 08:54:55 -0600 Subject: [PATCH 12/13] Set a DeviceFormat instance's type attribute to the requested type. It will still be a DeviceFormat instance, but it will have a type that is not None and will reflect what was requested. --- blivet/formats/__init__.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/blivet/formats/__init__.py b/blivet/formats/__init__.py index c8ddc0b..4a6c416 100644 --- a/blivet/formats/__init__.py +++ b/blivet/formats/__init__.py @@ -91,6 +91,14 @@ def getFormat(fmt_type, *args, **kwargs): className = fmt.__class__.__name__ except AttributeError: className = None + + # this allows us to store the given type for formats we implement as + # DeviceFormat. + if fmt_type and fmt.type is None: + # this should add/set an instance attribute + fmt._type = fmt_type + fmt._name = None + log.debug("getFormat('%s') returning %s instance" % (fmt_type, className)) return fmt @@ -137,7 +145,7 @@ def get_device_format_class(fmt_type): class DeviceFormat(object): """ Generic device format. """ _type = None - _name = "Unknown" + _name = _("Unknown") _udevTypes = [] partedFlag = None partedSystem = None -- 1.8.1