diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2010-02-08 05:03:28 -0700 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2010-02-12 17:07:37 -0500 |
commit | 069763c5c616221fd0bcea813cad93ae3f7c072d (patch) | |
tree | 3c7944836ca68119671482e3ee2f9365032fa640 /ipalib/plugable.py | |
parent | 338578d10ac0978a00948971a17a89dc95435954 (diff) | |
download | freeipa-069763c5c616221fd0bcea813cad93ae3f7c072d.tar.gz freeipa-069763c5c616221fd0bcea813cad93ae3f7c072d.tar.xz freeipa-069763c5c616221fd0bcea813cad93ae3f7c072d.zip |
Add Object.label class attribute, enable in webUI
Diffstat (limited to 'ipalib/plugable.py')
-rw-r--r-- | ipalib/plugable.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/ipalib/plugable.py b/ipalib/plugable.py index 4473409e1..ded762d19 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): """ |