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:
|
# Register some properties for the 'user' object:
|
||||||
class user_givenname(public.prop):
|
class user_givenname(public.Property):
|
||||||
'User first name'
|
'User first name'
|
||||||
required = True
|
required = True
|
||||||
api.register(user_givenname)
|
api.register(user_givenname)
|
||||||
|
|
||||||
class user_sn(public.prop):
|
class user_sn(public.Property):
|
||||||
'User last name'
|
'User last name'
|
||||||
required = True
|
required = True
|
||||||
api.register(user_sn)
|
api.register(user_sn)
|
||||||
|
|
||||||
class user_login(public.prop):
|
class user_login(public.Property):
|
||||||
'User login'
|
'User login'
|
||||||
required = True
|
required = True
|
||||||
def default(self, **kw):
|
def default(self, **kw):
|
||||||
@@ -76,7 +76,7 @@ class user_login(public.prop):
|
|||||||
return ('%s%s' % (givenname[0], sn)).lower()
|
return ('%s%s' % (givenname[0], sn)).lower()
|
||||||
api.register(user_login)
|
api.register(user_login)
|
||||||
|
|
||||||
class user_initials(public.prop):
|
class user_initials(public.Property):
|
||||||
'User initials'
|
'User initials'
|
||||||
required = True
|
required = True
|
||||||
def default(self, **kw):
|
def default(self, **kw):
|
||||||
|
|||||||
@@ -252,23 +252,23 @@ class Command(plugable.Plugin):
|
|||||||
class obj(plugable.Plugin):
|
class obj(plugable.Plugin):
|
||||||
__public__ = frozenset((
|
__public__ = frozenset((
|
||||||
'Method',
|
'Method',
|
||||||
'prop',
|
'Property',
|
||||||
))
|
))
|
||||||
__Method = None
|
__Method = None
|
||||||
__prop = None
|
__Property = None
|
||||||
|
|
||||||
def __get_Method(self):
|
def __get_Method(self):
|
||||||
return self.__Method
|
return self.__Method
|
||||||
Method = property(__get_Method)
|
Method = property(__get_Method)
|
||||||
|
|
||||||
def __get_prop(self):
|
def __get_Property(self):
|
||||||
return self.__prop
|
return self.__Property
|
||||||
prop = property(__get_prop)
|
Property = property(__get_Property)
|
||||||
|
|
||||||
def finalize(self, api):
|
def finalize(self, api):
|
||||||
super(obj, self).finalize(api)
|
super(obj, self).finalize(api)
|
||||||
self.__Method = self.__create_ns('Method')
|
self.__Method = self.__create_ns('Method')
|
||||||
self.__prop = self.__create_ns('prop')
|
self.__Property = self.__create_ns('Property')
|
||||||
|
|
||||||
def __create_ns(self, name):
|
def __create_ns(self, name):
|
||||||
return plugable.NameSpace(self.__filter(name))
|
return plugable.NameSpace(self.__filter(name))
|
||||||
@@ -321,18 +321,18 @@ class Method(attr, Command):
|
|||||||
def get_options(self):
|
def get_options(self):
|
||||||
for proxy in Command.get_options(self):
|
for proxy in Command.get_options(self):
|
||||||
yield proxy
|
yield proxy
|
||||||
if self.obj is not None and self.obj.prop is not None:
|
if self.obj is not None and self.obj.Property is not None:
|
||||||
for proxy in self.obj.prop():
|
for proxy in self.obj.Property():
|
||||||
yield proxy
|
yield proxy
|
||||||
|
|
||||||
|
|
||||||
class prop(attr, option):
|
class Property(attr, option):
|
||||||
__public__ = attr.__public__.union(option.__public__)
|
__public__ = attr.__public__.union(option.__public__)
|
||||||
|
|
||||||
def get_doc(self, _):
|
def get_doc(self, _):
|
||||||
return _('prop doc')
|
return _('Property doc')
|
||||||
|
|
||||||
|
|
||||||
class PublicAPI(plugable.API):
|
class PublicAPI(plugable.API):
|
||||||
def __init__(self):
|
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
|
pass
|
||||||
class option1(public.option):
|
class option1(public.option):
|
||||||
pass
|
pass
|
||||||
class example_prop0(public.prop):
|
class example_prop0(public.Property):
|
||||||
pass
|
pass
|
||||||
class example_prop1(public.prop):
|
class example_prop1(public.Property):
|
||||||
pass
|
pass
|
||||||
class example_obj(object):
|
class example_obj(object):
|
||||||
__prop = None
|
__prop = None
|
||||||
@@ -375,14 +375,14 @@ class test_Method(ClassChecker):
|
|||||||
if self.__prop is None:
|
if self.__prop is None:
|
||||||
self.__prop = plugable.NameSpace([
|
self.__prop = plugable.NameSpace([
|
||||||
plugable.PluginProxy(
|
plugable.PluginProxy(
|
||||||
public.prop, example_prop0(), 'attr_name'
|
public.Property, example_prop0(), 'attr_name'
|
||||||
),
|
),
|
||||||
plugable.PluginProxy(
|
plugable.PluginProxy(
|
||||||
public.prop, example_prop1(), 'attr_name'
|
public.Property, example_prop1(), 'attr_name'
|
||||||
),
|
),
|
||||||
])
|
])
|
||||||
return self.__prop
|
return self.__prop
|
||||||
prop = property(__get_prop)
|
Property = property(__get_prop)
|
||||||
class noun_verb(self.cls):
|
class noun_verb(self.cls):
|
||||||
option_classes = (option0, option1)
|
option_classes = (option0, option1)
|
||||||
obj = example_obj()
|
obj = example_obj()
|
||||||
@@ -403,7 +403,7 @@ class test_Method(ClassChecker):
|
|||||||
|
|
||||||
|
|
||||||
class test_prop(ClassChecker):
|
class test_prop(ClassChecker):
|
||||||
_cls = public.prop
|
_cls = public.Property
|
||||||
|
|
||||||
def test_class(self):
|
def test_class(self):
|
||||||
assert self.cls.__bases__ == (public.attr, public.option)
|
assert self.cls.__bases__ == (public.attr, public.option)
|
||||||
|
|||||||
Reference in New Issue
Block a user