[Freeipa-devel] updates and deletes
Kevin McCarthy
kmccarth at redhat.com
Thu Aug 16 16:33:57 UTC 2007
Rob Crittenden wrote:
> Karl MacMillan wrote:
>> If we don't expose the attributes directly but hide them behind methods
>> we could also track changes to the python object, generate a modlist
>> from that, and pass only mods to the XML-RPC layer.
>
> I'm going to leave this to Kevin to answer. I'm not sure how it would work
> with the GUI. I think that everything goes through setValue() so we could
> theoretically track changes.
>
> The LDAP API provides a very nice function that generates the modlist for
> us. It would be really nice to be able to use that.
The gui needs to track changes across multiple pages. I was originally
planning on using hidden fields for each mutable field (phone_orig, etc).
Then manually comparing at the end before submitting.
Rob's latest API patch has changed how I do things. Now I'm taking
user = client.get_user(uid)
user_data = b64encode(dumps(user.toDict()))
and stuffing user_data into a hidden field.
During the final update, I just
orig_user = loads(b64decode(kw.get('user_orig')))
new_user = dict(orig_user)
new_user['givenname'] = kw.get('givenname')
new_user['sn'] = kw.get('sn')
new_user['mail'] = kw.get('mail')
new_user['telephoneNumber'] = kw.get('telephoneNumber')
client.update_user(orig_user, new_user)
Either way, if I have the original and new values, I can pass in the
hashes or call setters on fields that have changed. Both work for me.
-Kevin
-------------- 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/20070816/d33a0385/attachment.bin>
More information about the Freeipa-devel
mailing list