ome / omero-py

Python project containing Ice remoting code for OMERO
https://www.openmicroscopy.org/omero
GNU General Public License v2.0
21 stars 32 forks source link

Method to add time to ParametersI #327

Closed muhanadz closed 2 years ago

muhanadz commented 2 years ago

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)
muhanadz commented 2 years ago

@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.