Skip to content

Commit

Permalink
#144: Add documentation and style changes
Browse files Browse the repository at this point in the history
  • Loading branch information
MRichards99 committed Sep 14, 2020
1 parent d3b08e4 commit 9a1b060
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions common/database/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

log = logging.getLogger()


class DatabaseWhereFilter(WhereFilter):
def __init__(self, field, value, operation):
super().__init__(field, value, operation)
Expand All @@ -24,7 +25,10 @@ def __init__(self, field, value, operation):

def _extract_filter_fields(self, field):
"""
TODO - Add docstring
Extract the related fields names and put them into separate variables
:param field: ICAT field names, separated by dots
:type field: :class:`str`
"""

fields = field.split(".")
Expand All @@ -44,7 +48,6 @@ def _extract_filter_fields(self, field):
else:
raise ValueError(f"Maximum include depth exceeded. {field}'s depth > 3")


def apply_filter(self, query):
try:
field = getattr(query.table, self.field)
Expand Down
2 changes: 1 addition & 1 deletion common/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class WhereFilter(QueryFilter):
precedence = 1

def __init__(self, field, value, operation):
# The field is set to None as a precaution but this should be set by the
# The field is set to None as a precaution but this should be set by the
# individual backend since backends deal with this data differently
self.field = None
self.value = value
Expand Down

0 comments on commit 9a1b060

Please sign in to comment.