mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
185: Renamed public.prop to Property
This commit is contained in:
@@ -55,17 +55,17 @@ api.register(user_find)
|
||||
|
||||
|
||||
# Register some properties for the 'user' object:
|
||||
class user_givenname(public.prop):
|
||||
class user_givenname(public.Property):
|
||||
'User first name'
|
||||
required = True
|
||||
api.register(user_givenname)
|
||||
|
||||
class user_sn(public.prop):
|
||||
class user_sn(public.Property):
|
||||
'User last name'
|
||||
required = True
|
||||
api.register(user_sn)
|
||||
|
||||
class user_login(public.prop):
|
||||
class user_login(public.Property):
|
||||
'User login'
|
||||
required = True
|
||||
def default(self, **kw):
|
||||
@@ -76,7 +76,7 @@ class user_login(public.prop):
|
||||
return ('%s%s' % (givenname[0], sn)).lower()
|
||||
api.register(user_login)
|
||||
|
||||
class user_initials(public.prop):
|
||||
class user_initials(public.Property):
|
||||
'User initials'
|
||||
required = True
|
||||
def default(self, **kw):
|
||||
|
||||
@@ -252,23 +252,23 @@ class Command(plugable.Plugin):
|
||||
class obj(plugable.Plugin):
|
||||
__public__ = frozenset((
|
||||
'Method',
|
||||
'prop',
|
||||
'Property',
|
||||
))
|
||||
__Method = None
|
||||
__prop = None
|
||||
__Property = None
|
||||
|
||||
def __get_Method(self):
|
||||
return self.__Method
|
||||
Method = property(__get_Method)
|
||||
|
||||
def __get_prop(self):
|
||||
return self.__prop
|
||||
prop = property(__get_prop)
|
||||
def __get_Property(self):
|
||||
return self.__Property
|
||||
Property = property(__get_Property)
|
||||
|
||||
def finalize(self, api):
|
||||
super(obj, self).finalize(api)
|
||||
self.__Method = self.__create_ns('Method')
|
||||
self.__prop = self.__create_ns('prop')
|
||||
self.__Property = self.__create_ns('Property')
|
||||
|
||||
def __create_ns(self, name):
|
||||
return plugable.NameSpace(self.__filter(name))
|
||||
@@ -321,18 +321,18 @@ class Method(attr, Command):
|
||||
def get_options(self):
|
||||
for proxy in Command.get_options(self):
|
||||
yield proxy
|
||||
if self.obj is not None and self.obj.prop is not None:
|
||||
for proxy in self.obj.prop():
|
||||
if self.obj is not None and self.obj.Property is not None:
|
||||
for proxy in self.obj.Property():
|
||||
yield proxy
|
||||
|
||||
|
||||
class prop(attr, option):
|
||||
class Property(attr, option):
|
||||
__public__ = attr.__public__.union(option.__public__)
|
||||
|
||||
def get_doc(self, _):
|
||||
return _('prop doc')
|
||||
return _('Property doc')
|
||||
|
||||
|
||||
class PublicAPI(plugable.API):
|
||||
def __init__(self):
|
||||
super(PublicAPI, self).__init__(Command, obj, Method, prop)
|
||||
super(PublicAPI, self).__init__(Command, obj, Method, Property)
|
||||
|
||||
@@ -365,9 +365,9 @@ class test_Method(ClassChecker):
|
||||
pass
|
||||
class option1(public.option):
|
||||
pass
|
||||
class example_prop0(public.prop):
|
||||
class example_prop0(public.Property):
|
||||
pass
|
||||
class example_prop1(public.prop):
|
||||
class example_prop1(public.Property):
|
||||
pass
|
||||
class example_obj(object):
|
||||
__prop = None
|
||||
@@ -375,14 +375,14 @@ class test_Method(ClassChecker):
|
||||
if self.__prop is None:
|
||||
self.__prop = plugable.NameSpace([
|
||||
plugable.PluginProxy(
|
||||
public.prop, example_prop0(), 'attr_name'
|
||||
public.Property, example_prop0(), 'attr_name'
|
||||
),
|
||||
plugable.PluginProxy(
|
||||
public.prop, example_prop1(), 'attr_name'
|
||||
public.Property, example_prop1(), 'attr_name'
|
||||
),
|
||||
])
|
||||
return self.__prop
|
||||
prop = property(__get_prop)
|
||||
Property = property(__get_prop)
|
||||
class noun_verb(self.cls):
|
||||
option_classes = (option0, option1)
|
||||
obj = example_obj()
|
||||
@@ -403,7 +403,7 @@ class test_Method(ClassChecker):
|
||||
|
||||
|
||||
class test_prop(ClassChecker):
|
||||
_cls = public.prop
|
||||
_cls = public.Property
|
||||
|
||||
def test_class(self):
|
||||
assert self.cls.__bases__ == (public.attr, public.option)
|
||||
|
||||
Reference in New Issue
Block a user