Skip to content
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

Allow a caller to ignore row numbers #418

Merged
merged 1 commit into from
Jul 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions src/omero/hdfstorageV2.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,13 +550,21 @@ def getWhereList(self, stamp, condition, variables, unused,
aue.serverExceptionClass = str(err.__class__.__name__)
raise aue

def _as_data(self, cols, rowNumbers):
def _as_data(self, cols, rowNumbers, current):
"""
Constructs a omero.grid.Data object for returning to the client.
"""
include_row_numbers = True
try:
include_row_numbers = current.ctx.get(
"omero.tables.include_row_numbers", "true"
).lower() == "true"
except Exception:
pass
data = omero.grid.Data()
data.columns = cols
data.rowNumbers = rowNumbers
if include_row_numbers:
data.rowNumbers = rowNumbers
# Convert to millis since epoch
data.lastModification = int(self._stamp * 1000)
return data
Expand All @@ -568,7 +576,7 @@ def readCoordinates(self, stamp, rowNumbers, current):
cols = self.cols(None, current)
for col in cols:
col.readCoordinates(self.__mea, rowNumbers)
return self._as_data(cols, rowNumbers)
return self._as_data(cols, rowNumbers, current)

@stamped
def read(self, stamp, colNumbers, start, stop, current):
Expand All @@ -586,7 +594,7 @@ def read(self, stamp, colNumbers, start, stop, current):
elif start is None and stop is None:
rowNumbers = list(range(self.__length()))

return self._as_data(cols, rowNumbers)
return self._as_data(cols, rowNumbers, current)

@stamped
def slice(self, stamp, colNumbers, rowNumbers, current):
Expand All @@ -604,7 +612,7 @@ def slice(self, stamp, colNumbers, rowNumbers, current):
col = cols[i]
col.readCoordinates(self.__mea, rowNumbers)
rv.append(col)
return self._as_data(rv, rowNumbers)
return self._as_data(rv, rowNumbers, current)

#
# Lifecycle methods
Expand Down