summaryrefslogtreecommitdiffstats
path: root/ipalib
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2008-11-13 21:07:47 -0700
committerJason Gerard DeRose <jderose@redhat.com>2008-11-13 21:07:47 -0700
commit8ad5502354a364db606b72455c5514cb56e918ba (patch)
tree6bd9e8481c0268fea7095b3ffab354bb93f51f4d /ipalib
parent01a7f1f437b72c2c13c6abfb02c6dea3924fa291 (diff)
downloadfreeipa-8ad5502354a364db606b72455c5514cb56e918ba.tar.gz
freeipa-8ad5502354a364db606b72455c5514cb56e918ba.tar.xz
freeipa-8ad5502354a364db606b72455c5514cb56e918ba.zip
Added util.make_repr() function; added corresponding unit tests
Diffstat (limited to 'ipalib')
-rw-r--r--ipalib/frontend.py1
-rw-r--r--ipalib/util.py9
2 files changed, 10 insertions, 0 deletions
diff --git a/ipalib/frontend.py b/ipalib/frontend.py
index 56c4ea01f..87126a440 100644
--- a/ipalib/frontend.py
+++ b/ipalib/frontend.py
@@ -227,6 +227,7 @@ class Param(plugable.ReadOnly):
)
def __init__(self, name, **override):
+ self.__override = override
if not ('required' in override or 'multivalue' in override):
(name, kw_from_spec) = parse_param_spec(name)
override.update(kw_from_spec)
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))