summaryrefslogtreecommitdiffstats
path: root/ipalib
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2008-09-24 23:19:34 +0000
committerJason Gerard DeRose <jderose@redhat.com>2008-09-24 23:19:34 +0000
commitc3b09b2116dcbab36098f11c6b3684a6d0e47c08 (patch)
tree8180aecb42f10ec22d65b658f3741f3500d96dd7 /ipalib
parent3d6ab69b46e5be32af94ecdfb5a696973eeaf7c4 (diff)
downloadfreeipa-c3b09b2116dcbab36098f11c6b3684a6d0e47c08.tar.gz
freeipa-c3b09b2116dcbab36098f11c6b3684a6d0e47c08.tar.xz
freeipa-c3b09b2116dcbab36098f11c6b3684a6d0e47c08.zip
352: Now removed Object.Property property and added in its place Object.properties instance attribute
Diffstat (limited to 'ipalib')
-rw-r--r--ipalib/frontend.py15
-rw-r--r--ipalib/tests/test_frontend.py14
2 files changed, 13 insertions, 16 deletions
diff --git a/ipalib/frontend.py b/ipalib/frontend.py
index c3b1707b..132e3039 100644
--- a/ipalib/frontend.py
+++ b/ipalib/frontend.py
@@ -512,11 +512,11 @@ class Command(plugable.Plugin):
class Object(plugable.Plugin):
__public__ = frozenset((
'methods',
- 'Property',
+ 'properties',
'params'
))
methods = None
- __Property = None
+ properties = None
takes_params = tuple()
def __init__(self):
@@ -528,15 +528,10 @@ class Object(plugable.Plugin):
for param in self.takes_params:
yield create_param(param)
-
- def __get_Property(self):
- return self.__Property
- Property = property(__get_Property)
-
def set_api(self, api):
super(Object, self).set_api(api)
self.methods = self.__create_namespace('Method')
- self.__Property = self.__create_namespace('Property')
+ self.properties = self.__create_namespace('Property')
def __create_namespace(self, name):
return plugable.NameSpace(self.__filter_members(name))
@@ -596,14 +591,14 @@ class Method(Attribute, Command):
def get_options(self):
for option in self.takes_options:
yield option
- if self.obj is not None and self.obj.Property is not None:
+ if self.obj is not None and self.obj.properties is not None:
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(self.obj.Property(), key=get_key):
+ for prop in sorted(self.obj.properties(), key=get_key):
yield prop.param
diff --git a/ipalib/tests/test_frontend.py b/ipalib/tests/test_frontend.py
index f0ba524d..0109934d 100644
--- a/ipalib/tests/test_frontend.py
+++ b/ipalib/tests/test_frontend.py
@@ -760,7 +760,9 @@ class test_Object(ClassChecker):
def test_class(self):
assert self.cls.__bases__ == (plugable.Plugin,)
- assert type(self.cls.Property) is property
+ assert self.cls.methods is None
+ assert self.cls.properties is None
+ assert self.cls.takes_params == tuple()
def test_init(self):
"""
@@ -768,7 +770,7 @@ class test_Object(ClassChecker):
"""
o = self.cls()
assert o.methods is None
- assert read_only(o, 'Property') is None
+ assert o.properties is None
def test_set_api(self):
"""
@@ -798,7 +800,7 @@ class test_Object(ClassChecker):
cnt = 10
formats = dict(
methods='method_%d',
- Property='property_%d',
+ properties='property_%d',
)
class api(object):
@@ -806,7 +808,7 @@ class test_Object(ClassChecker):
get_attributes(cnt, formats['methods'])
)
Property = plugable.NameSpace(
- get_attributes(cnt, formats['Property'])
+ get_attributes(cnt, formats['properties'])
)
assert len(api.Method) == cnt * 3
assert len(api.Property) == cnt * 3
@@ -818,7 +820,7 @@ class test_Object(ClassChecker):
o = user()
o.set_api(api)
assert read_only(o, 'api') is api
- for name in ['methods', 'Property']:
+ for name in ['methods', 'properties']:
namespace = getattr(o, name)
assert isinstance(namespace, plugable.NameSpace)
assert len(namespace) == cnt
@@ -919,7 +921,7 @@ class test_Method(ClassChecker):
),
])
return self.__prop
- Property = property(__get_prop)
+ properties = property(__get_prop)
type_ = ipa_types.Unicode()
class noun_verb(self.cls):
takes_options= (