ome / omero-py

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

Update omero/gateway/__init__.py #293

Closed aherbert closed 3 years ago

aherbert commented 3 years ago

Add missing key= to the sort expression lambda

joshmoore commented 3 years ago

Thanks, @aherbert. I've added a label so it should be included in automated testing tomorrow.

dominikl commented 3 years ago

Could you provide some testing instructions for this @aherbert ?

aherbert commented 3 years ago

From an OMERO cli environment enter this from a python terminal:

import omero
from omero.gateway import BlitzGateway
# Should be an admin or someone who can see a lot of users
conn = BlitzGateway('user', 'password', host='whereever.com')
conn.connect()
for e in conn.findExperimenters():
    print(e.id, e.getFullName())
for e in conn.findExperimenters('root'):
    print(e.id, e.getFullName())

Currently the method findExperimenters() will throw an error due to invalid syntax. With the fix it will return all the users or a subset if the optional start param is used.

joshmoore commented 3 years ago

@dominikl : did you have any feedback on this?

will-moore commented 3 years ago

Without this PR:

>>> for e in conn.findExperimenters():
...     print(e.id, e.getFullName())
... 
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/wmoore/Desktop/PY/omero-py/target/omero/gateway/__init__.py", line 3044, in findExperimenters
    rv.sort(lambda x, y: cmp(x.omeName.val, y.omeName.val))
TypeError: sort() takes no positional arguments

With this PR it works as expected.

Good to merge 👍

joshmoore commented 3 years ago

Hi @aherbert. We've started requiring contributors to sign a Contributor License Agreement (CLA). Could you download the CLA form, fill and sign it and return it by email to contributors@openmicroscopy.org. Thanks again for the contribution!

https://ome-contributing.readthedocs.io/en/latest/cla.html

aherbert commented 3 years ago

@joshmoore CLA all done.

joshmoore commented 3 years ago

Thanks!