Skip to content

Commit

Permalink
ISPyB LIMS: make it possible to use custom ISPyB adapter object
Browse files Browse the repository at this point in the history
Adds a factory method _create_data_adapter(), which creates an
instance of data adapter.

This allows to supply different implementation of the adapter
objects in custom ISPyB LIMS classes.
  • Loading branch information
elmjag authored and marcus-oscarsson committed Feb 5, 2025
1 parent 9efe5e3 commit 5142a4d
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions mxcubecore/HardwareObjects/abstract/ISPyBAbstractLims.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,7 @@ def init(self):
except AttributeError:
pass

self.adapter = ISPyBDataAdapter(
self.ws_root.strip(),
self.proxy,
self.ws_username,
self.ws_password,
self.beamline_name,
)
self.adapter = self._create_data_adapter()
logging.getLogger("HWR").debug("[ISPYB] Proxy address: %s" % self.proxy)

# Add the porposal codes defined in the configuration xml file
Expand All @@ -89,6 +83,15 @@ def init(self):
except AttributeError:
pass

def _create_data_adapter(self) -> ISPyBDataAdapter:
return ISPyBDataAdapter(
self.ws_root.strip(),
self.proxy,
self.ws_username,
self.ws_password,
self.beamline_name,
)

def get_lims_name(self) -> List[Lims]:
return [
Lims(
Expand Down

0 comments on commit 5142a4d

Please sign in to comment.