Skip to content

Commit

Permalink
refactor: make changes for new Python ICAT implementation #259
Browse files Browse the repository at this point in the history
  • Loading branch information
MRichards99 committed Jan 26, 2022
1 parent cafabc5 commit f61ed00
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions datagateway_api/src/search_api/filters.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from icat.client import Client
from icat.query import Query

from datagateway_api.src.datagateway_api.icat.filters import (
Expand All @@ -7,6 +6,7 @@
PythonICATSkipFilter,
PythonICATWhereFilter,
)
from datagateway_api.src.search_api.session_handler import SessionHandler

# TODO - Implement each of these filters for Search API, inheriting from the Python ICAT
# versions
Expand All @@ -20,17 +20,14 @@ def apply_filter(self, query):
return super().apply_filter(query)

def __str__(self):
# TODO - replace with `SessionHandler.client` when that work is merged
client = Client("https://localhost.localdomain:8181", checkCert=False)
client.login("simple", {"username": "root", "password": "pw"})

# TODO - can't just hardcode investigation entity. Might need `icat_entity_name`
# to be passed into init
query = Query(client, "Investigation")
query = Query(SessionHandler.client, "Investigation")
query.addConditions(self.create_filter())
str_conds = query.get_conditions_as_str()
str_conds = query.where_clause
str_conds = str_conds.replace("WHERE ", "")

return str_conds[0]
return str_conds

def __repr__(self):
return (
Expand Down

0 comments on commit f61ed00

Please sign in to comment.