diff options
author | Petr Viktorin <pviktori@redhat.com> | 2013-01-16 10:26:37 -0500 |
---|---|---|
committer | Petr Viktorin <pviktori@redhat.com> | 2014-02-21 11:58:00 +0100 |
commit | eef5acd9d73c81133969521ed9fc7e82d5f180ab (patch) | |
tree | 49a72ae985acf73a43d8da630b5156e9ca2a9535 /ipalib | |
parent | 9a8f44c09e0e78550b126235240214e7b11af081 (diff) | |
download | freeipa-eef5acd9d73c81133969521ed9fc7e82d5f180ab.tar.gz freeipa-eef5acd9d73c81133969521ed9fc7e82d5f180ab.tar.xz freeipa-eef5acd9d73c81133969521ed9fc7e82d5f180ab.zip |
Remove the unused ipalib.frontend.Property class
This class was built into the framework from its early days but it's
not used anywhere.
Remove it along with its tests
https://fedorahosted.org/freeipa/ticket/3460
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
Diffstat (limited to 'ipalib')
-rw-r--r-- | ipalib/__init__.py | 7 | ||||
-rw-r--r-- | ipalib/frontend.py | 57 |
2 files changed, 5 insertions, 59 deletions
diff --git a/ipalib/__init__.py b/ipalib/__init__.py index ab89ab77e..553c07197 100644 --- a/ipalib/__init__.py +++ b/ipalib/__init__.py @@ -883,7 +883,7 @@ import os import plugable from backend import Backend from frontend import Command, LocalOrRemote, Updater, Advice -from frontend import Object, Method, Property +from frontend import Object, Method from crud import Create, Retrieve, Update, Delete, Search from parameters import DefaultFrom, Bool, Flag, Int, Decimal, Bytes, Str, IA5Str, Password, DNParam, DeprecatedParam from parameters import BytesEnum, StrEnum, IntEnum, AccessTime, File @@ -910,14 +910,11 @@ def create_api(mode='dummy'): - `frontend.Method` - - `frontend.Property` - - `frontend.Advice` - `backend.Backend` """ - api = plugable.API(Command, Object, Method, Property, Backend, Updater, - Advice) + api = plugable.API(Command, Object, Method, Backend, Updater, Advice) if mode is not None: api.env.mode = mode assert mode != 'production' diff --git a/ipalib/frontend.py b/ipalib/frontend.py index 4d0333e0d..76c53eba5 100644 --- a/ipalib/frontend.py +++ b/ipalib/frontend.py @@ -1126,7 +1126,6 @@ class Object(HasParam): # Create stubs for attributes that are set in _on_finalize() backend = Plugin.finalize_attr('backend') methods = Plugin.finalize_attr('methods') - properties = Plugin.finalize_attr('properties') params = Plugin.finalize_attr('params') primary_key = Plugin.finalize_attr('primary_key') params_minus_pk = Plugin.finalize_attr('params_minus_pk') @@ -1139,9 +1138,6 @@ class Object(HasParam): self.methods = NameSpace( self.__get_attrs('Method'), sort=False, name_attr='attr_name' ) - self.properties = NameSpace( - self.__get_attrs('Property'), sort=False, name_attr='attr_name' - ) self._create_param_namespace('params') pkeys = filter(lambda p: p.primary_key, self.params()) if len(pkeys) > 1: @@ -1196,25 +1192,19 @@ class Object(HasParam): """ This method gets called by `HasParam._create_param_namespace()`. """ - props = self.properties.__todict__() for spec in self._get_param_iterable('params'): if type(spec) is str: key = spec.rstrip('?*+') else: assert isinstance(spec, Param) key = spec.name - if key in props: - yield props.pop(key).param - else: - yield create_param(spec) + yield create_param(spec) def get_key(p): if p.param.required: if p.param.default_from is None: return 0 return 1 return 2 - for prop in sorted(props.itervalues(), key=get_key): - yield prop.param class Attribute(Plugin): @@ -1249,8 +1239,7 @@ class Attribute(Plugin): 'add' In practice the `Attribute` class is not used directly, but rather is - only the base class for the `Method` and `Property` classes. Also see - the `Object` class. + only the base class for the `Method` class. Also see the `Object` class. """ finalize_early = False @@ -1350,8 +1339,7 @@ class Method(Attribute, Command): {'result': 'Added the user!'} The `Attribute` base class implements the naming convention for the - attribute-to-object association. Also see the `Object` and the - `Property` classes. + attribute-to-object association. Also see the `Object` class. """ extra_options_first = False extra_args_first = False @@ -1373,45 +1361,6 @@ class Method(Attribute, Command): yield param -class Property(Attribute): - klass = Str - default = None - default_from = None - normalizer = None - - def __init__(self): - super(Property, self).__init__() - # FIXME: This is a hack till Param.label is updated to require a - # LazyText instance: - self.label = None - self.rules = tuple( - sorted(self.__rules_iter(), key=lambda f: getattr(f, '__name__')) - ) - self.kwargs = tuple( - sorted(self.__kw_iter(), key=lambda keyvalue: keyvalue[0]) - ) - kw = dict(self.kwargs) - self.param = self.klass(self.attr_name, *self.rules, **kw) - - def __kw_iter(self): - for (key, kind, default) in self.klass.kwargs: - if getattr(self, key, None) is not None: - yield (key, getattr(self, key)) - - def __rules_iter(self): - """ - Iterates through the attributes in this instance to retrieve the - methods implementing validation rules. - """ - for name in dir(self.__class__): - if name.startswith('_'): - continue - base_attr = getattr(self.__class__, name) - if is_rule(base_attr): - attr = getattr(self, name) - if is_rule(attr): - yield attr - class Updater(Method): """ An LDAP update with an associated object (always update). |