From 069763c5c616221fd0bcea813cad93ae3f7c072d Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Mon, 8 Feb 2010 05:03:28 -0700 Subject: Add Object.label class attribute, enable in webUI --- ipalib/plugable.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'ipalib/plugable.py') diff --git a/ipalib/plugable.py b/ipalib/plugable.py index 4473409e..ded762d1 100644 --- a/ipalib/plugable.py +++ b/ipalib/plugable.py @@ -37,9 +37,13 @@ import optparse import errors from config import Env import util +import text from base import ReadOnly, NameSpace, lock, islocked, check_name from constants import DEFAULT_CONFIG, FORMAT_STDERR, FORMAT_FILE +# FIXME: Updated constants.TYPE_ERROR to use this clearer format from wehjit: +TYPE_ERROR = '%s: need a %r; got a %r: %r' + class SetProxy(ReadOnly): """ @@ -155,6 +159,8 @@ class Plugin(ReadOnly): Base class for all plugins. """ + label = None + def __init__(self): self.__api = None cls = self.__class__ @@ -177,6 +183,17 @@ class Plugin(ReadOnly): self.name, name, getattr(self, name)) ) setattr(self, name, getattr(log, name)) + if self.label is None: + self.label = text.FixMe(self.name + '.label') + if not isinstance(self.label, text.LazyText): + raise TypeError( + TYPE_ERROR % ( + self.fullname + '.label', + text.LazyText, + type(self.label), + self.label + ) + ) def __get_api(self): """ -- cgit