Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

get_service->find_service

  • Loading branch information...
commit 47f181cb6f4d633cc4d1c837f9b2722d32357114 1 parent fe4e8c5
@mcdonc mcdonc authored
View
2  substanced/folder/__init__.py
@@ -52,7 +52,7 @@ def __init__(self, data=None):
self.data = OOBTree(data)
self._num_objects = Length(len(data))
- def get_service(self, service_name):
+ def find_service(self, service_name):
""" Return a service named by ``service_name`` in this folder's
``__services__`` folder *or any parent service folder* or ``None`` if
no such service exists."""
View
8 substanced/folder/tests/test_folder.py
@@ -432,17 +432,17 @@ def test_resolveable_unicode_getitem(self):
folder[name] = DummyModel()
self.failUnless(folder[name])
- def test_get_service_missing(self):
+ def test_find_service_missing(self):
inst = self._makeOne()
- self.assertEqual(inst.get_service('abc'), None)
+ self.assertEqual(inst.find_service('abc'), None)
- def test_get_service_found(self):
+ def test_find_service_found(self):
inst = self._makeOne()
inst2 = self._makeOne()
inst3 = self._makeOne()
inst.add('__services__', inst2, allow_services=True)
inst2['abc'] = inst3
- self.assertEqual(inst.get_service('abc'), inst3)
+ self.assertEqual(inst.find_service('abc'), inst3)
class DummyModel:
pass
View
20 substanced/principal/__init__.py
@@ -123,7 +123,7 @@ def __init__(self, description):
self.description = description
def _resolve_member(self, member_or_memberid):
- objectmap = self.get_service('objectmap')
+ objectmap = self.find_service('objectmap')
if oid_of(member_or_memberid, None) is None:
# it's a group id
member = objectmap.object_for(member_or_memberid)
@@ -152,19 +152,19 @@ def set_properties(self, struct):
def get_memberids(self):
""" Returns a sequence of member ids which belong to this group. """
- objectmap = self.get_service('objectmap')
+ objectmap = self.find_service('objectmap')
return objectmap.sourceids(self, UserToGroup)
def get_members(self):
""" Returns a generator of member objects which belong to this group.
"""
- objectmap = self.get_service('objectmap')
+ objectmap = self.find_service('objectmap')
return objectmap.sources(self, UserToGroup)
def connect(self, *members):
""" Connect this group to one or more user objects or user
objectids."""
- objectmap = self.get_service('objectmap')
+ objectmap = self.find_service('objectmap')
for memberid in members:
member = self._resolve_member(memberid)
if member is not None:
@@ -175,7 +175,7 @@ def disconnect(self, *members):
objectids."""
if not members:
members = self.get_memberids()
- objectmap = self.get_service('objectmap')
+ objectmap = self.find_service('objectmap')
for memberid in members:
member = self._resolve_member(memberid)
if member is not None:
@@ -273,7 +273,7 @@ def __init__(self, password, email='', security_question='',
self.security_answer = security_answer
def _resolve_group(self, group_or_groupid):
- objectmap = self.get_service('objectmap')
+ objectmap = self.find_service('objectmap')
if oid_of(group_or_groupid, None) is None:
# it's a group id
group = objectmap.object_for(group_or_groupid)
@@ -316,19 +316,19 @@ def set_properties(self, struct):
def get_groupids(self, objectmap=None):
""" Returns a sequence of group ids which this user is a member of. """
if objectmap is None:
- objectmap = self.get_service('objectmap')
+ objectmap = self.find_service('objectmap')
return objectmap.targetids(self, UserToGroup)
def get_groups(self):
""" Returns a generator of group objects which this user is a member
of."""
- objectmap = self.get_service('objectmap')
+ objectmap = self.find_service('objectmap')
return objectmap.targets(self, UserToGroup)
def connect(self, *groups):
""" Connect this user to one or more group objects or group
objectids."""
- objectmap = self.get_service('objectmap')
+ objectmap = self.find_service('objectmap')
for groupid in groups:
group = self._resolve_group(groupid)
if group is not None:
@@ -339,7 +339,7 @@ def disconnect(self, *groups):
objectids."""
if not groups:
groups = self.get_groupids()
- objectmap = self.get_service('objectmap')
+ objectmap = self.find_service('objectmap')
for groupid in groups:
group = self._resolve_group(groupid)
if group is not None:
Please sign in to comment.
Something went wrong with that request. Please try again.