[Freeipa-devel] [PATCH] fix user.getValue()

Kevin McCarthy kmccarth at redhat.com
Fri Aug 10 23:13:36 UTC 2007


I think we should be looking at the value instead of value[0] to
determine what it is.  I stumbled across this bug because I was able to
submit telephoneNumber as an empty string.  The code was blowing up
trying to do a value[0] on "".

This raises a point about whether we should allow empty strings into
LDAP.  Pete had some points about this, but I'll allow him to state them
(since I'm not sure I understood them).

-Kevin
-------------- next part --------------
# HG changeset patch
# User Kevin McCarthy <kmccarth at redhat.com>
# Date 1186790755 25200
# Node ID 50e8f67f0989c7f05d0d178dd85687ca4f2f76a7
# Parent  dfe9b959b3608a49e387422196e7495a6bde000e
Fix getValue.  It should be looking at value, not value[0]

diff -r dfe9b959b360 -r 50e8f67f0989 ipa-python/user.py
--- a/ipa-python/user.py	Fri Aug 10 14:37:09 2007 -0700
+++ b/ipa-python/user.py	Fri Aug 10 17:05:55 2007 -0700
@@ -58,7 +58,7 @@ class User:
     def getValue(self,name):
         """Get the first value for the attribute named name"""
         value =  self.data.get(name,[None])
-        if isinstance(value[0],list) or isinstance(value[0],tuple):
+        if isinstance(value,list) or isinstance(value,tuple):
             return value[0]
         else:
             return value
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 2228 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20070810/71c905e7/attachment.bin>


More information about the Freeipa-devel mailing list