Skip to content
This repository has been archived by the owner on Sep 28, 2022. It is now read-only.

Commit

Permalink
Merge pull request #64 from postatum/100377958_userself_400
Browse files Browse the repository at this point in the history
Call ES.get_resource with ID from ACLs
  • Loading branch information
jstoiko committed Aug 3, 2015
2 parents 6ef62e6 + 0f7710f commit 9d9bbe5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions ramses/acl.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,7 @@ def getitem_es(self, key):
""" Get item with ID of :key: from elasticsearch """
from nefertari.elasticsearch import ES
es = ES(self.__context_class__.__name__)
pk_field = self.__context_class__.pk_field()
obj = es.get_resource(**{pk_field: key})
obj = es.get_resource(id=key)
obj.__acl__ = self.context_acl(obj)
obj.__parent__ = self
obj.__name__ = key
Expand Down
2 changes: 1 addition & 1 deletion tests/test_acl.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def test_getitem_es(self, mock_es):
obj.context_acl = Mock()
value = obj.getitem_es(key='varvar')
mock_es.assert_called_with('Foo')
es_obj.get_resource.assert_called_once_with(myname='varvar')
es_obj.get_resource.assert_called_once_with(id='varvar')
obj.context_acl.assert_called_once_with(found_obj)
assert value.__acl__ == obj.context_acl()
assert value.__parent__ is obj
Expand Down

0 comments on commit 9d9bbe5

Please sign in to comment.