Fixed the format modules import
Looks good to me.
On Wed, 2009-03-11 at 12:57 +0100, Martin Gracik wrote:
> ---
> storage/formats/__init__.py | 7 ++++---
> 1 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/storage/formats/__init__.py b/storage/formats/__init__.py
> index 2b6acae..3cdc908 100644
> --- a/storage/formats/__init__.py
> +++ b/storage/formats/__init__.py
> @@ -102,11 +102,12 @@ def collect_device_format_classes():
> """
> dir = os.path.dirname(__file__)
> for module_file in os.listdir(dir):
> - if module_file.endswith(".py"):
> + # make sure we're not importing this module
> + if module_file.endswith(".py") and module_file != __file__:
> mod_name = module_file[:-3]
> - # FIXME: use imputils here instead of exec
> + # imputil is deprecated in python 2.6
> try:
> - exec("import %s" % mod_name)
> + globals()[mod_name] = __import__(mod_name)
> except ImportError, e:
> log.debug("import of device format module '%s' failed" % mod_name)
>
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
|