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

Potential AttributeError in SessionsStore.create #225

Closed tlambert03 closed 4 years ago

tlambert03 commented 4 years ago

I'm not sure what the best way to fix this is (without potentially breaking other stuff you depend on), but there is an assumption being made in SessionsStore.create() that a self.ctx attribute has been injected into the object "somewhere" else:

https://github.com/ome/omero-py/blob/8d711f577d1000aad49ea794324b49450c952878/src/omero/util/sessions.py#L406-L410

If you create an unowned store, and try store.create() but hit an exception when submitting the TimeoutRequest, then the exception is not handled correctly.

sbesson commented 4 years ago

@tlambert03 thanks for spotting this issue and reporting it. You are correct, self.ctx is typically a context defined in BaseControl instances and used in omero/plugins/sessions.py but the classes in omero/util/sessions.py have no awareness of it.

My immediate feeling is that these calls should be simply replaced by self.logger.debug as in a few other places in this class.