When validating the arguments, compare with None.
----- "David Lehman" <dlehman@redhat.com> wrote:
> Good catch. You can also use 'map.dev.minor is not None' to improve
> readability.
mmm. yep, that is kinda better. will change it. Any other comments ?
>
> 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@redhat.com
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list
--
Joel Andres Granados
Red Hat / Brno Czech Republic
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
|