Re: [PATCH] When validating the arguments, compare with None.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Good catch. You can also use 'map.dev.minor is not None' to improve
readability.

On Thu, 2009-01-15 at 17:18 +0100, Joel Granados Moreno wrote:
> ---
>  __init__.py |   12 ++++++------
>  1 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/__init__.py b/__init__.py
> index 523ad74..db4bf01 100644
> --- a/__init__.py
> +++ b/__init__.py
> @@ -214,9 +214,9 @@ def getDmDeps(uuid = None, major = None, minor = None, name = None):
>      # If has dpes, return a set of maps, else return an empty set.
>      for map in dm.maps():
>          if (map.name and map.name == name) or \
> -                (map.uuid and map.uuid == uuid) or \
> -                (map.dev.minor and map.dev.minor == long(minor) and \
> -                 map.dev.major and map.dev.major == long(major)):
> +                (not map.uuid is None and map.uuid == uuid) or \
> +                (not map.dev.minor is None and map.dev.minor == long(minor)and\
> +                 not map.dev.major is None and map.dev.major == long(major)):
>              return map.deps
>      return None
>  
> @@ -234,9 +234,9 @@ def getDmTarget(uuid = None, major = None, minor = None, name = None):
>      # Return None if we don't find the map.
>      for map in dm.maps():
>          if (map.name and map.name == name) or \
> -                (map.uuid and map.uuid == uuid) or \
> -                (map.dev.minor and map.dev.minor == long(minor) and \
> -                 map.dev.major and map.dev.major == long(major)):
> +                (not map.uuid is None and map.uuid == uuid) or \
> +                (not map.dev.minor is None and map.dev.minor == long(minor)and\
> +                 not map.dev.major is None and map.dev.major == long(major)):
>              # might be worth validating tupe.
>              return map.table.type
>      return None

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux