From 46e37ab14491db06ffa46b682c079c397e644014 Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Thu, 18 Dec 2008 11:21:12 -0700 Subject: New Param: ported Param.__repr__() and corresponding unit test --- ipalib/parameter.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'ipalib/parameter.py') diff --git a/ipalib/parameter.py b/ipalib/parameter.py index fca95b0e..76a9cd50 100644 --- a/ipalib/parameter.py +++ b/ipalib/parameter.py @@ -24,6 +24,7 @@ Parameter system for command plugins. from types import NoneType from plugable import ReadOnly, lock, check_name from constants import NULLS, TYPE_ERROR, CALLABLE_ERROR +from util import make_repr class DefaultFrom(ReadOnly): @@ -287,6 +288,16 @@ class Param(ReadOnly): # And we're done. lock(self) + def __repr__(self): + """ + Return an expresion that could construct this `Param` instance. + """ + return make_repr( + self.__class__.__name__, + self.param_spec, + **self.__kw + ) + def normalize(self, value): """ Normalize ``value`` using normalizer callback. -- cgit