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

Update omero/gateway/__init__.py #293

Merged
merged 1 commit into from
Jul 12, 2021
Merged

Update omero/gateway/__init__.py #293

merged 1 commit into from
Jul 12, 2021

Conversation

aherbert
Copy link
Contributor

Add missing key= to the sort expression lambda

Add missing key= to the sort expression

The UnicodeType in python3 does not exist. This fixes the code for python3 as the omero_type function will create an rstring from the string type.

If this is python2.7 a unicode string will still be a unicode string after formatting as ('%s%%' % start) and the omero_type function will correctly encode it.
@joshmoore
Copy link
Member

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

@dominikl
Copy link
Member

Could you provide some testing instructions for this @aherbert ?

@aherbert
Copy link
Contributor Author

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
Copy link
Member

@dominikl : did you have any feedback on this?

@will-moore
Copy link
Member

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 joshmoore merged commit 5651c67 into ome:master Jul 12, 2021
@joshmoore
Copy link
Member

joshmoore commented Jul 12, 2021

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
Copy link
Contributor Author

@joshmoore CLA all done.

@joshmoore
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants