summaryrefslogtreecommitdiffstats
path: root/ipa-python/user.py
diff options
context:
space:
mode:
authorrcritten@redhat.com <rcritten@redhat.com>2007-08-14 17:22:05 -0400
committerrcritten@redhat.com <rcritten@redhat.com>2007-08-14 17:22:05 -0400
commit5f0f23ee91d51b2a45206ce7d9ddc413d3fa9670 (patch)
tree92fd71833e1689e008ccb4844350c566ebfd0b16 /ipa-python/user.py
parent547f501faee224d7d5d6998ce457fd2df0fd465d (diff)
downloadfreeipa-5f0f23ee91d51b2a45206ce7d9ddc413d3fa9670.tar.gz
freeipa-5f0f23ee91d51b2a45206ce7d9ddc413d3fa9670.tar.xz
freeipa-5f0f23ee91d51b2a45206ce7d9ddc413d3fa9670.zip
Ensure that the Apache server is in forked mode
Add ability to update existing users Try to prevent fetching and setting empty strings
Diffstat (limited to 'ipa-python/user.py')
-rw-r--r--ipa-python/user.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/ipa-python/user.py b/ipa-python/user.py
index 6162354be..3c925bfb3 100644
--- a/ipa-python/user.py
+++ b/ipa-python/user.py
@@ -58,6 +58,8 @@ class User:
def getValue(self,name):
"""Get the first value for the attribute named name"""
value = self.data.get(name,[None])
+ if (len(value) < 1):
+ return value
if isinstance(value[0],list) or isinstance(value[0],tuple):
return value[0]
else:
@@ -72,6 +74,8 @@ class User:
ent.setValue('name', ('value1', 'value2', ..., 'valueN'))
Since *value is a tuple, we may have to extract a list or tuple from that
tuple as in the last two examples above"""
+ if (len(value[0]) < 1):
+ return
if isinstance(value[0],list) or isinstance(value[0],tuple):
self.data[name] = value[0]
else:
@@ -85,6 +89,15 @@ class User:
single value or a list of values."""
return self.data.items()
+ def toDict(self):
+ """Convert the attrs and values to a dict. The dict is keyed on the
+ attribute name. The value is either single value or a list of values."""
+ result = {}
+ for k in self.data.keys():
+ result[k] = self.data[k]
+ result['dn'] = self.dn
+ return result
+
def attrList(self):
"""Return a list of all attributes in the entry"""
return self.data.keys()