-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scoped object search #373
base: master
Are you sure you want to change the base?
Scoped object search #373
Conversation
# TODO | ||
params['ancestor_id'] = self.id | ||
params['limit'] = 1000 | ||
return super(Object, self).search(query, **params) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe I left this TODO in here in order to determine if there should be a recursive option. Should the user be able to get anything in this folder, or just depth=0 objects.
and/or ancestor_id
needs to be replaced by parent_object_id
(although the server may handle this)
This PR needs tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets keep it ancestor_id so that it is recursive. Users can pass depth=0 if they want, and we will document this.
return self.objects(query=query, **params) | ||
|
||
def search(self, query='', **params): | ||
query = query or params.pop('query', '') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not necessary
# TODO | ||
params['ancestor_id'] = self.id | ||
params['limit'] = 1000 | ||
return super(Object, self).search(query, **params) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Object.search(), super not necessary because search is a classmethod
Search from within the folders/files/dataset shortcuts in the same way as
Object.search
, but scope it to the shortcut in both location and object typeThe following searches can be replaced with one nice command
become