[Freeipa-devel] [PATCH] 251 additional pylint fixes

Martin Nagy mnagy at redhat.com
Thu Aug 13 08:28:57 UTC 2009


On Wed, 2009-08-12 at 13:16 -0400, Rob Crittenden wrote:
> I fixed a few more issues discovered by pylint.
> 
> rob

[snip]
--- a/ipapython/ipautil.py
+++ b/ipapython/ipautil.py
@@ -605,10 +605,11 @@ def user_input_path(prompt, default = None,
allow_empty = True):
         prompt += " (enter \"none\" for empty)"
     while True:
         ret = user_input(prompt, default, allow_empty)
-        if allow_empty and ret.lower() == "none":
-            return ""
-        if ipavalidate.Path(ret, not allow_empty):
-            return ret
+        if isinstance(ret, basestring):
+            if allow_empty and ret.lower() == "none":
+                return ""
+            if ipavalidate.Path(ret, not allow_empty):
+                return ret

I don't like this piece. The return of user_input() should always be a
string unless the default parameter of user_input_path() is a bool or
int. Assert at the beginning of user_input_path() would be better.

But anyway, it seems we don't use this function anyway (probably after
we changed to the plug-in framework), so I'd vote to completely remove
it instead.

Martin




More information about the Freeipa-devel mailing list