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

Method to add time to ParametersI #327

Merged
merged 1 commit into from May 24, 2022
Merged

Conversation

muhanadz
Copy link
Member

Added new addTime() method for omero.sys.ParametersI class. Added tests to test this method.

Without this PR, adding rtime type object required manual mapping:

params = omero.sys.ParametersI()
date = datetime.datetime.fromtimestamp(1)
params.map["Date"] = omero.rtypes.rtime(date)

With this PR, it is possible to add the date directly:

params = omero.sys.ParametersI()
date = datetime.datetime.fromtimestamp(1)
params.addTime("Date", date)

Copy link
Member

@sbesson sbesson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The API addition looks straightforward and mirrors the existing convenience methods for passing primary types. The change will require a minor release incremental to mark the backwards-compatible API and potentially could go in with #326.

@muhanadz is there a location in the OMERO.py/OMERO.web that could make use of this new API?

@muhanadz
Copy link
Member Author

@sbesson I'm not sure. I simply needed to add time to an HQL query via the ParametersI() model but instead had to manually map the datetime object, since there wasn't a method for that. Added this method in case someone needed this in the future.

@sbesson sbesson added this to the 5.12.0 milestone May 24, 2022
@sbesson sbesson merged commit 266133b into ome:master May 24, 2022
@muhanadz muhanadz deleted the add_addTime branch May 24, 2022 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants