diff options
Diffstat (limited to 'ipalib/util.py')
-rw-r--r-- | ipalib/util.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/ipalib/util.py b/ipalib/util.py index 9bc432545..89e2c5a74 100644 --- a/ipalib/util.py +++ b/ipalib/util.py @@ -137,3 +137,12 @@ class LogFormatter(logging.Formatter): Log formatter that uses UTC for all timestamps. """ converter = time.gmtime + + +def make_repr(name, *args, **kw): + """ + Construct a standard representation of a class instance. + """ + args = [repr(a) for a in args] + kw = ['%s=%r' % (k, kw[k]) for k in sorted(kw)] + return '%s(%s)' % (name, ', '.join(args + kw)) |