Hi,
I noticed a few things that seem out of place in lib389’s cli tools. I just want to point
out that using raw print isn’t really correct. Using log allows us to capture the written
output for test verification, so always use log, not print.
If you are then writing a function on a lib389 dsldapobject, you shouldn’t directly log
the output either. You should return it (probably as a dict!) to the caller. This way the
caller can either display/format the object correctly *or* they can consume the data in
further functions. Even more important, by simply returning a dict, you can consume the
_json magic. I saw an example where get_attr_vals was used, and then ensure_str called,
then json transformed. The better way would have been to use get_attr_vals_utf8_json()
which would have done all the correct wrapping and transformation for you :)
I know it seems nitpicky, but little details like this matter for testing and api
cleanliness and reuse in future applications :)
Thanks,
—
Sincerely,
William Brown
Software Engineer, 389 Directory Server
SUSE Labs