[PATCH 12/13] Set a DeviceFormat instance's type attribute to the requested type.
David Lehman
dlehman at redhat.com
Fri Mar 1 22:13:30 UTC 2013
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
More information about the anaconda-patches
mailing list